Easy Tutorial
❮ Html Wrapinner Jquery Callback ❯

jQuery has() Method

jQuery Traversal Methods

Example

Return all <p> elements that have a <span> element inside them:


Definition and Usage

The has() method returns all elements that have one or more elements matching the specified selector inside them.

Tip: To select elements that have multiple elements inside them, use a comma to separate the selectors (see the example below).


Syntax

Parameter Description
element Required. Specifies the selector expression or element to match.

More Examples

Return elements with multiple elements inside them

Return all <p>, <h3>, and <div> elements that have a <span> element inside them

Return elements that contain links


jQuery Traversal Methods

❮ Html Wrapinner Jquery Callback ❯