You’re looking for the .each()
method.
For example:
$('.ring-preview').children('img').each(function(i) {
$(this).rotate(ring.stones[i].stone_rotation);
});
If the <img>
elements aren’t direct children, you’ll need to call .find
instead of .children
.