Although most of the front-end use jquery, but to jquery these selectors in use of similarities and differences, we should usually not care too much, or also smattering it!
Below is a brief summary of the following:
1.filter:
. Filter (selector)
. filter (function (index))
. Filter (Element)
. Filter (JQuery object)
And the find difference is that find is the operation of a subset of it, and the filter is an operation on its own collection element
2.find:
. Find (selector)
A. Find (jquery object) is one of the jquery objects used to match elements.
A. Find (Element) is a DOM element that is used to match elements.
The difference from children is that children only finds child elements, not descendant elements
3.children:
. Children ([selector])
The selector string that matches the element. Children (". Selected")
4.contents: The method returns all immediate child elements, including the text of the selected element and the comment node. A text node is the actual text that is displayed by the element. This method is similar to the children () method, but the difference is that it returns text and comment sections
and children the difference is that including text and comment nodes
5.contains:
JQuery (': Contains (text) ')
<div>john resig</div>
matches the text $ ("Div:contains (' John ')"). CSS ("text-decoration", "underline");//Find all DIV elements that contain "John"
$ ("ul Li" >.filter (": Contains (' Canon '),: Contains (' Nikon '),: Contains (' phone ')")). AddClass ("promoted");
Reprint: https://www.cnblogs.com/LiaoHao/p/3353335.html
The difference between filter, find, children, contents, contains in jquery