jQuery overall element index
Is there a way to use jQuery index() method to find the index of an element related to the overall document?
I mean, if I have a bunch of img tags in a document, is there a way to know, regardless of their position in the document, their index?
<body> <img /> <div> <img /> <div> <img /> </div> </div> </body>
I've tried using $(window), $(body), $(document), but they all fail. I really need the overall index of the element.
index() returns the position in a given collection:
Do you mean