jQuery包装的集合中的元素顺序是否总是与元素在标记中出现的顺序匹配? [英] Does the order of elements in a jQuery-wrapped set always match the order in which the elements appear in the markup?

查看:61
本文介绍了jQuery包装的集合中的元素顺序是否总是与元素在标记中出现的顺序匹配?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否确保jQuery包装集中的元素顺序与元素在标记中出现的顺序相匹配?

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.

我可以只使用匹配集上的.each()迭代器运行该操作并始终获得正确的顺序吗,还是我需要找到其他方法来确保该操作顺序与嵌套顺序相匹配?

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?

推荐答案

jQuery将自上而下匹配您的查询,因此匹配的集合将始终相同.

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

这篇关于jQuery包装的集合中的元素顺序是否总是与元素在标记中出现的顺序匹配?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆