jQuery traversal - descendants

Traverse down the DOM

children()

find()


children() method

The children() method returns all direct children of the selected element (only children).

The parameters are optional. Adding parameters means filtering through the selector and filtering the elements.

       

p (儿子元素) span (孙子元素)

p (儿子元素) span (孙子元素)

Returns all

elements with class name "1" that are direct children of


find( ) Method

find() method returns the descendant elements of the selected element, all the way down to the last descendant.

The parameter is required and can be a selector, jQuery object or element to filter elements.

       

p (儿子元素) span (孙子元素)

p (儿子元素) span (孙子元素)

Returns all elements that are descendants of

.

Continuing Learning
||
php中文网(php.cn)
  • I
  • II
      不包括自己
    • A
    • B
      • 1
      • 2
      • 3
    • C
  • III
submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!