Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR 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
 
PREVIOUS NEXT
Tagged: #picks
ADD COMMENT
Topic
Name
6+2 =