jQuery :has() Selector (original) (raw)
Last Updated : 11 Jul, 2025
The **jQuery :has() selector in jQuery is used to select all elements that have one or more elements inside of them, that match the specified selector.
**Syntax:
$(":has(selector)")
**Parameter: This selector contains a single parameter **selector which is mandatory and used to specify the element to select. It is also required to accept any kind of selector.
**Example 1: This example uses:has selector to select
span element to create a solid green border.
HTML `
jQuery :has() SelectorGeeksForGeeks
jQuery :has() Selector
`
**Output:
**Example 2: This example uses:has selector to select elements and create a border.
html `
jQuery :has() SelectorGeeksForGeeks
jQuery :has() Selector
`
**Output:
