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 .