How to get a specific jQuery item from a list of items?
The get
method returns the DOM element, so then you would have to wrap it inside a new jQuery object.
You can use the eq
method:
var j = $('ul li').eq(1); // gets the second list item
The get
method returns the DOM element, so then you would have to wrap it inside a new jQuery object.
You can use the eq
method:
var j = $('ul li').eq(1); // gets the second list item