Let’s say I have a list like this:
<ul class="list">
<li><span class="pos"><div class="txt_pos">1</div></li>
<li><span class="pos"><div class="txt_pos">2</div></li>
<li><span class="pos"><div class="txt_pos">3</div></li>
<li><span class="pos"><div class="txt_pos">4</div></li>
<li><span class="pos"><div class="txt_pos">5</div></li>
</ul>
and my JS:
$(".list span.pos").each(function(i) {
var newOne = i;
newRank = getNth(newOne);
$("> .txt_pos").slideToggle('slow');
$(this).text(newRank);
$("> .txt_pos").slideToggle('slow');
});
How do I make it select each li because right now, it’s doing EVERY list item at ONCE. I’m trying to select the child of the .pos.
1 Answer