1:children及find方法都用是用来获得element的子elements的,两者都不会返回 text node,就像大多数的jQuery方法一样。
2:children方法获得的仅仅是元素一下级的子元素,即:immediate children。
3:find方法获得所有下级元素,即:descendants of these elements in the DOM tree
4:children方法的参数selector 是可选的(optionally),用来过滤子元素,但find方法的参数selector方法是必选的。
5:find方法事实上可以通过使用 jQuery( selector, context )来实现:英语如是说:Selector context is implemented with the .find() method; therefore, $('li.item-ii').find('li') is equivalent to $('li', 'li.item-ii').
jquery的find用法
最新推荐文章于 2025-09-19 09:54:56 发布
本文阐述了jQuery中children及find方法的区别:children方法仅获取直接子元素;find方法则可获取所有后代元素。children方法参数可选,用于过滤子元素;而find方法参数必选。find方法可通过jQuery(selector, context)实现。
1176

被折叠的 条评论
为什么被折叠?



