亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

jQuery初學:find()方法及children方法的區(qū)別分析

 更新時間:2011年01月31日 23:19:42   作者:  
總經(jīng)一下前段時間用于的jQuery方法:find及children。需要的朋友可以參考下。
首先看看英文解釋吧:
children方法:

find方法:

通過以上的解釋,可以總結(jié)如下:
1:children及find方法都用是用來獲得element的子elements的,兩者都不會返回 text node,就像大多數(shù)的jQuery方法一樣。
2:children方法獲得的僅僅是元素一下級的子元素,即:immediate children。
3:find方法獲得所有下級元素,即:descendants of these elements in the DOM tree
4:children方法的參數(shù)selector 是可選的(optionally),用來過濾子元素,但find方法的參數(shù)selector方法是必選的。
5:find方法事實上可以通過使用 jQuery( selector, context )來實現(xiàn):英語如是說:Selector context is implemented with the .find() method; therefore, $('li.item-ii').find('li') is equivalent to $('li', 'li.item-ii').

例如,有以下html元素:

使用:$('ul.level-2').children().css('border', '1px solid green'); 的效果是:

使用 $('ul.level-2').find('li').css('border', '1px solid green'); 的效果是:

相關文章

最新評論