1 line
1.5 KiB
JSON
1 line
1.5 KiB
JSON
{"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<table border=\"1\">\n <tr><td>Value 1</td><td></td></tr>\n <tr><td>Value 2</td><td></td></tr>\n</table>\n"},"longdesc":"\n <p>This is the inverse of <code>:empty</code>. </p>\n <p>One important thing to note regarding the use of <code>:parent</code> (and <code>:empty</code>) is that child nodes include text nodes.</p>\n <p>The W3C recommends that the <code><p></code> element have at least one child node, even if that child is merely text (see <a href=\"http://www.w3.org/TR/html401/struct/text.html#edef-P\">http://www.w3.org/TR/html401/struct/text.html#edef-P</a>). Some other elements, on the other hand, are empty (i.e. have no children) by definition:<code> <input></code>, <code><img></code>, <code><br></code>, and <code><hr></code>, for example.</p>\n <p>To obtain the parents or ancestors of an existing jQuery set, see the <code><a href=\"/parent/\">.parent()</a></code> and <code><a href=\"/parents/\">.parents()</a></code> methods.</p>\n "}],"slug":"parent-selector"} |