<div id="myDiv">
<a>...</a>
<a>...</a>
<a>...</a>
<a>...</a>
<a>...</a>
<a>...</a>
</div>
If you wanted to select the 2nd, 3rd and 4th a
tags in the above example, how would you do that? The only thing I can think of is:
$("#myDiv a:eq(1), #myDiv a:eq(2), #myDiv a:eq(3)")
But that doesn't look to be very efficient or pretty. I guess you could also select ALL the a
s and then do run .each
over them, but that could get very inefficient if there were a lot more a
s.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…