1. 程式人生 > >獲取子元素 children()和find()的異同:

獲取子元素 children()和find()的異同:

 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),用來過濾子元素

特別注意:第2/3條