English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
:has() selector selects all elements that contain one or more elements within them, matching the specified selector.
$":has(selector)")
Select all <p> elements that contain at least one <span> element:
$("document").ready(function(){ $("p:has(span)").css("background", "coral"); });Test and See‹/›
Parameter | Description |
---|---|
selector | Any Selector |