Jquery provides many methods to traverse nodes. In fact, jquery
API1.4.4 is described in this document. However, they are all relatively simple introductions and there are not many examples. So I decided to use these jquery methods to demonstrate them online using mengsanqiu online testing tools, this allows you to easily understand and apply it to actual projects.
Next, let's talk about the children method in jquery DOM operations.
The. children ([selector]) method returns a set of direct child elements of each matching element. Note the differences between the child element and the child element.
Selector is an optional parameter, which is a selector expression used to filter sub-elements.
Let's take a look at the online DEMO of the. children () method without parameters:
Next, let's take a look at the online DEMO with parameters: