$("#rightCol").children().children().children("div.entry").length
I tried this
$("#rightCol").children().eq(1).children("div.entry").length
or this
$("#rightCol").children(":eq(1)").children("div.entry").length
with no success. ideas?
$("#rightCol").children().children().children("div.entry").length
I tried this
$("#rightCol").children().eq(1).children("div.entry").length
or this
$("#rightCol").children(":eq(1)").children("div.entry").length
with no success. ideas?
You can do it using the child-selector (>
), like this:
$("#rightCol > * > * > div.entry").length
Though, if you know the child type, I'd use that over *
. If he level doesn't matter, just a descendant selector () will work.
$("#rightCol div.entry").length
Depending on the layout (do you have DIVs with that class at other levels that you want to avoid?), you might get by with
$('#rightCol').find('div.entry').length
This should work, if you must have the specific level in the descendant tree.
$("#rightCol > * > * > div.entry")
However, this is more normal. It would pick any "div.entry" inside of "#rightCol", regardless of the depth.
$("#rightCol div.entry")