If I iterate through a selector, what order of elements do I get?
Suppose I dynamically add three images, one after the other, to my document. They all have the same class, so I can use a jQuery selector for the class to retrieve them all. The third image has a position on the page near the top. They are all within a DIV.
I would like to retrieve them in order that the appear to the human eye.
But a class selector would retrieve them in the order that they were added, so the image nearest the top of the page is retrieved last.
I suppose I could sort the images by position after I retrieve them, but that is complicated.
If I used a selector for the DIV that contains them all, would that help? maybe something like:
$(
"div" ).children()?
Thanks.