{"name":"parent","type":"selector","title":":parent Selector","deprecated":null,"removed":null,"desc":"Select all elements that have at least one child node (either an element or text).","categories":["selectors/content-filter-selector","selectors/jquery-selector-extensions","version/1.0"],"entries":[{"return":"","signatures":{"added":"1.0"},"examples":{"desc":"Finds all tds with children, including text.","code":"\n$( \"td:parent\" ).fadeTo( 1500, 0.3 );\n","css":"\n td {\n width: 40px;\n background: green;\n }\n","html":"\n\n \n \n
Value 1
Value 2
\n"},"longdesc":"\n

This is the inverse of :empty.

\n

One important thing to note regarding the use of :parent (and :empty) is that child nodes include text nodes.

\n

The W3C recommends that the <p> element have at least one child node, even if that child is merely text (see http://www.w3.org/TR/html401/struct/text.html#edef-P). Some other elements, on the other hand, are empty (i.e. have no children) by definition: <input>, <img>, <br>, and <hr>, for example.

\n

To obtain the parents or ancestors of an existing jQuery set, see the .parent() and .parents() methods.

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