This article mainly introduces the usage of the filter () function and the find () function in jQuery. The examples compare and analyze the functions and usage skills of the filter () function and the find () function, for more information about how to use the filter () function and find () function in jQuery, see the following example. Share it with you for your reference. The specific analysis is as follows:
$ ("P. cont ");
Equivalent to $ ("p"). find (". cont ")
The filter () function is used on every object in the Set ($ (what is obtained here,
The find () function is used to search for child elements of matching expressions within each object.
Example:
Asdf
Jldf
The Code is as follows:
$ ("P"). filter (". cont") // obtain
Label
Indicates that the p element with class cont is found.
The Code is as follows:
$ ("P"). find (". cont") // obtain
Label
After p is found, find the cont element in the child element of p.
I hope this article will help you with jQuery programming.