jQuery搜索“孩子"和“找到"之间的区别? [英] JQuery difference between searching 'children' and 'find'?

查看:90
本文介绍了jQuery搜索“孩子"和“找到"之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在搜索嵌套Div时,哪一种优先于另一种?

When is one preferred over the other when searching for nested Divs?

推荐答案

查找是递归的,其中子级在DOM中的深度仅为1级.看看这个: http://blog.ekini.net/2009/03/16/jquery-children-vs-find-which-is-faster/

Find is recursive, where children looks only 1 level deep in the DOM. Check out this: http://blog.ekini.net/2009/03/16/jquery-children-vs-find-which-is-faster/

注意:实际上引用了Stackoverflow帖子.

Note: that is actually references a Stackoverflow post.

无论哪种方式,都应该有助于回答您的问题.如果您需要搜索多个级别,请使用查找",如果不使用子级,则搜索更快.

Either way, that should help answer your question. If you need to search more than one level use Find, if not use children as it is faster.

这篇关于jQuery搜索“孩子"和“找到"之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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