jQuery has() method
Example
Return those having one all having two elements inside them
element:
$("p").has("span")
Try it »
Definition and Usage
The has() method returns all elements that have one or more elements inside them matching the specified selector.
**Tip:** To select elements that have multiple elements inside them, use a comma to separate them (see the examples below).
Syntax
$(
selector
).has(
element
)
| Parameters | Description |
|---|---|
| element | Required. Specifies a selector expression or element to match elements. |
More examples
Return elements with multiple elements inside them
How to return elements with multiple elements inside them.
Return those having all of the having elements inside them
and
Element
How to return those having all of the having elements inside them
,
and
.
Return elements that contain links
How to return those containing hyperlinks .
How to return those having all of the having elements inside them
,
and
.
Return elements that contain links
How to return those containing hyperlinks .
Return elements that contain links
How to return those containing hyperlinks .
jQuery Traversal Methods