The example in this article describes the usage of the children() method in jQuery. Share it with everyone for your reference. The specific analysis is as follows:
This method obtains an element set containing all child elements of each element in the matching element set.
Matched child elements can be filtered through optional expressions.
Note: find() will find all child elements, while children() only gets first-level child elements.
Grammar structure:
Parameter list:
Example code:
Example 1:
I am grandson p
I am my son p
I am a brotherp
This method only matches first-level child elements.
Example 2:
I am grandson p
I am my sonp
I am a brotherp
The above code can set the font color in the child element whose class attribute value is children to red.