Is the order of the elements in jQuery wrapped set guaranteed to match the order the elements appear in the markup?
I ask because I need to perform an operation on a set of nested elements, and I need to always do the operation in order of the nesting.
Can I just run the operation using the .each() iterator on the matched set and always get the right order, or do I need to find some other way to guarantee the operation order matches the nesting order?
.each()
jQuery will match your query top down so the matched set will always be the same.
2.1m questions
2.1m answers
60 comments
57.0k users