i searched the docs and couldnt find it :(
let's say i'm selecting all elements like:
var items = $(".myClass");
it returns eg. 5 items - now how can i grab select eg. the 2nd one? items(2) or items[2] doesnt work ..
i searched the docs and couldnt find it :(
let's say i'm selecting all elements like:
var items = $(".myClass");
it returns eg. 5 items - now how can i grab select eg. the 2nd one? items(2) or items[2] doesnt work ..
Try this:
items.eq(2) // gets the third element (zero-based index)
2nd item would be items[ 1 ]
in your case. Also the code you've provided works perfectly for me (with items[ 1 ]
).