Latest web development tutorials

jQuery: has () selector

jQuery selector jQuery selector

Examples

Select all contain <span> element within the <p> element:

$("p:has(span)")

try it"

Definition and Usage

: Has () Selector Select all elements in one or more elements therein, match the specified selector.

Tip: To select elements comprising a plurality of elements therein, use a comma (see example below).


grammar

$(":has( selector )")

参数 描述
selector 必需。规定要选取的元素。
该参数接受任何类型的选择器。


Examples

Try - Example

Selecting a plurality of elements comprising an element including
How to select multiple elements containing elements including.

Select the element does not contain the specified elements, including
The: not selector with the: has selector used together to select the element does not contain the elements including.


jQuery selector jQuery selector