December 2013
Intermediate to advanced
384 pages
9h 54m
English
$("div").get(); //returns an array of DOM object for all <div> elements $("div").get(0); //returns a DOM object for the first <div> $("div").get(-1); //returns a DOM object for the last <div>
The .get([index]) method returns the DOM elements represented in the jQuery object set. If no index is specified, an array of the DOM objects is returned. If an index is specified, the DOM element at that zero-based offset in the array is returned.
If the index is a negative number, the item at the reverse offset from the end of the array is returned. For example, –1 is the last item and –2 is the second to the last item.
Read now
Unlock full access