{"name":"has","type":"selector","title":":has() Selector","deprecated":null,"removed":null,"desc":"Selects elements which contain at least one element that matches the specified selector.","categories":["selectors/content-filter-selector","selectors/jquery-selector-extensions","version/1.1.4"],"entries":[{"return":"","signatures":{"added":"1.1.4","argument":{"desc":"Any selector.","name":"selector","type":"Selector"}},"examples":{"desc":"Adds the class \"test\" to all divs that have a paragraph inside of them.","code":"\n$( \"div:has(p)\" ).addClass( \"test\" );\n","html":"\n

Hello in a paragraph

\n
Hello again! (with no paragraph)
\n","css":"\n .test {\n border: 3px inset red;\n }\n"},"longdesc":"\n

The expression $( \"div:has(p)\" ) matches a <div> if a <p> exists anywhere among its descendants, not just as a direct child.

\n "}],"slug":"has-selector"}