I'd like to use the id selector:
$("#id")
Is there a way to do this to only the nth element with that ID on the page? i.e.
$("#id:n")
I'd like to use the id selector:
$("#id")
Is there a way to do this to only the nth element with that ID on the page? i.e.
$("#id:n")
There can be only ONE element with a given id in a page.
From the HTML norm :
There must not be multiple elements in a document that have the same id value.
Now suppose you want to get the nth element with a given class in your page, you may use eq :
$('.myclass').eq(index)
You can do like this:
$("#id:eq(n)")
But like @dystroy answer, it should be only 1 id in a page so you better using class.
You can use the :eq(n)
selector fetch the n-th item, but id should be unique.
You should use the class
attribute to group similar elements.