This article mainly introduces the usage of the has () method in jQuery. The example analyzes the functions and definitions of the has () method and the usage skills of retaining matching elements containing specific offspring, for more information about how to use the has () method in jQuery, see the following example. Share it with you for your reference. The specific analysis is as follows:
This method retains matching elements that contain specific offspring.
The. has () method creates a group of matched objects from the original jQuery object.
By deleting the selected parameter, the method traverses the original object's descendants, and the objects containing matched descendants are retained.
Syntax structure 1:
The code is as follows:
$ (Selector). has (expr)
Parameter list:
| Parameters |
Description |
| Expr |
String selector. |
Instance code:
The code is as follows:
Foot home