The difference between find() function and children() function based on jquery

The difference between find() function and children() function based on jquery

element.find(selector) returns the descendants of each element in the matching element set. The parameter selector is required. The element can be filtered through the selector to filter out the elements that meet the conditions. If you want to select all descendant elements, pass the parameter wildcard selector "*"

element.children(selector) returns the children of each element in the matching element set. The parameter selector is not required. If the parameter is omitted, all the children elements under element will be selected; if the parameter is passed in, it will be in the child element Filter it through the selector to filter out the elements that meet the conditions.

Summary: children will only traverse the next level of the specified DOM element, and find will traverse all the descendant levels of the specified DOM element

Extension: The find method to extend the selector context is realized by the find method.

jquery(selector,[context]) i.e. $(selector,[context])

Most people probably only use $(selector) to select elements. If only the first parameter is passed in, the matching element will be found under the document element.

If the second parameter is passed in, it will be searched from the context, and the order of the returned elements is equal to the order of appearance in the context.

(this).find("p"), ('li','li.item-ii')