I have a page similar to the structure below:
<div id="row_2">
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
</div>
How do I get the nth child of row_2, assuming that I cannot use that id (e.g. I’m on row_1 and I’m moving to the next one)
I have tried the following:
current.parent().next().children().filter(":nth-child("+i+")");
where “current” is an item on the previous “row div” and “i” is an index for an item, but this doesn’t work. I also tried using 0 in place of “i” to test it, but that doesn’t work either – where’s the error?
Assuming I’ve understood your question correctly, you are looking for
eq, notnth-child:As the docs state for
eq: