How to access child element out of children()?
- by user291701
Hi,
I'd like to get the # of immediate children an element has, and then get the class of a child at a particular index. Something like:
var index = 25;
var children = $("#myListElement").children();
if (index < children.length) {
if (children[index].hasClass("testClass")) {
alert("hi!");
}
}
I think the syntax for .children() is ok, but how do I get the indexed element out of them in jquery style?
Thanks