Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
191 views
in Technique[技术] by (71.8m points)

dom - Does the order of elements in a jQuery-wrapped set always match the order in which the elements appear in the markup?

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?

question from:https://stackoverflow.com/questions/1099759/does-the-order-of-elements-in-a-jquery-wrapped-set-always-match-the-order-in-whi

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

jQuery will match your query top down so the matched set will always be the same.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...