jQuery nth item of id/class

jquery

Solution

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)

Problem

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") ```

Original source