How to get collection of subelements at specific index in jquery
I have sample DOM:
<div class="x">
<div class="y">
<span>a</span>
<span>b</span>
<span>c</span>
</div>
<div class="y">
<span>d</span>
<span>e</span>
<span>f</span>
</div>
</div>
The jquery expression $(".x .y span")
returns all 6 span elements (a,b,c,d,e,f). The expression $(".x .y span:eq(1)")
returns only开发者_开发问答 one span element - b.
How should look expression returning collection of subelements at specific index, for exmaple at index 1 (b,e).
Regards
It should be
$(".x .y span:nth-child(2)")
e is not in the .y selector ! fix that before
精彩评论