1 line
957 B
JSON
1 line
957 B
JSON
{"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<div><p>Hello in a paragraph</p></div>\n<div>Hello again! (with no paragraph)</div>\n","css":"\n .test {\n border: 3px inset red;\n }\n"},"longdesc":"\n <p>The expression <code>$( \"div:has(p)\" )</code> matches a <code><div></code> if a <code><p></code> exists anywhere among its descendants, not just as a direct child.</p>\n "}],"slug":"has-selector"} |