Turns out jQuery's "implicit looping" goes both way:
<div class="classOne">
some content
</div>
<div class="classOne">
some content 2
</div>
[...]
$(function() { $('hello world').prependTo($('.classOne')); })
in this case, the loop will happen at the $('.classOne') section -- hello world will be added to both Divs.
I also tried
<div class="classOne">
some content
</div>
<div class="classOne">
some content 2
</div>
<div class="classTwo">
<a href="http://www.google.com">hello Google</a>
</div>
<div class="classTwo">
<a href="http://www.yahoo.com">hello Yahoo</a>
</div>
[...]
$(function() { $('.classTwo').prependTo($('.classOne')); })
and there will be "nested loops"... so the 2 links will be added to both Divs
so i think if we have
$('.classOne').prepend($('.classTwo')).prepend($('.classThree'))
then it will be like 3 nested loops? Is there a rule to the nesting, and which one is the inner loop and which one is the outer loop? And what is the inner loop / outer loop if it is
$('.classOne').prependTo($('.classTwo')).prependTo($('.classThree'))
?