Tutorial :jQuery create an array of objects with a specific class


Is there an array created somewhere of all the objects with a specific class? I want to find the sixth div with class="clCategory". Is there something like:




Or do I have to create the array at the same time I programmatically create each of the DIVs with class="clCategory"?


You're looking for eq(x)

It's 0-based, so the 6th would actually be #5



You can also query for $('.clCategory') and access it at [5] or even .get(5). The difference with either is that you would be getting the DOM HTMLElement, not the jQuery wrapped element as in my previous example.


You have to use nth child selector. See this related post.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »