We can use the children() method to get all direct children of the specified element.
The .children() method searches through the children elements in the DOM and constructs a new jQuery object from the elements that are matched.
The .children() method only travels a single level in the DOM tree.
If you want to traverse multiple levels and select all descendant elements (we call them grandchildren!) in the DOM tree then use the .find() method.
The .children() method doesn’t return text nodes.
We need use the .contents() method to get all children including text and comment nodes.
We can also optionally use selectors to filter out the elements. We can pass selectors using the $() function.
A quick example of jQuery .children() method
This example selects all direct children of ul with level-2 class.
Change style for all direct elements with a class using jQuery .children() method
Credit: jQuery Docs
child css selectors elements style