Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

document.queryselector picks first or last

var elFirst = document.querySelector(".myclass"); //first element
var elLast = document.querySelector(".myclass:last-child"); //last element

But be careful!
:last-child and :first-child are relevant to the parent element, 
not to the list! It means that there could be several first-childs 
and several last-childs
Comment

PREVIOUS NEXT
Code Example
Javascript :: React native calender date picker 
Javascript :: react redux thunk 
Javascript :: json parse in javascript 
Javascript :: update in mongoose node js 
Javascript :: js range array 
Javascript :: $.get jquery return value 
Javascript :: js object.entries with sort 
Javascript :: vscode add shortcut to run in terminal 
Javascript :: jquery vertical scroll 
Javascript :: How to end a session in ExpressJS 
Javascript :: javascript decimals without rounding 
Javascript :: how to use the map method in javascript 
Javascript :: how to remove first element from array in javascript 
Javascript :: node.js 8 has been deprecated. firebase functions 
Javascript :: then and catch in promise 
Javascript :: set id to div element in Javascript 
Javascript :: js array.some 
Javascript :: onclick node js 
Javascript :: js outputting data 
Javascript :: rich text react renderer 
Javascript :: mariadb JSON_ARRAYAGG does not exist 
Javascript :: how to upload image in react js 
Javascript :: react protected route 
Javascript :: Custom JavaScript URL Builder 
Javascript :: node js clear cache 
Javascript :: sequelize contains 
Javascript :: angular ng class with animation 
Javascript :: create new component in angular 
Javascript :: GET method firebase realtime database react 
Javascript :: on window resize js 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =