In jQuery, $("...").get(3) returns the 3rd DOM element. What is the function to return the 3rd jQuery element?
In jQuery, $("...").get(3) returns the 3rd DOM element. What is the function to return the 3rd jQuery element?
.eq() -An integer indicating the 0-based position of the element.
Ex:
Consider a page with a simple list on it:
<ul>
<li>list item 1</li>
<li>list item 2</li>
<li>list item 3</li>
<li>list item 4</li>
</ul>
We can apply this method to the set of list items:
$( "li" ).eq( 2 ).css( "background-color", "red" );