I have a div with the id ring-preview, it has a unspecifed number of img elements with the class stone-preview inside it.
I would like to iterate over each of these child images and call:
$(this).rotate(ring.stones[i].stone_rotation);
Where this refers the img element and i refers to its position within the div.
How can I do that?
You’re looking for the
.each()method.For example:
If the
<img>elements aren’t direct children, you’ll need to call.findinstead of.children.