Description: Select all elements that have at least one child node (either an element or text).
version added: 1.0jQuery( ":parent" )
This is the inverse of
One important thing to note regarding the use of
:empty) is that child nodes include text nodes.
The W3C recommends that the
<p> element have at least one child node, even if that child is merely text (see https://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:
<hr>, for example.
:parentis a jQuery extension and not part of the CSS specification, queries using
:parentcannot take advantage of the performance boost provided by the native DOM
querySelectorAll()method. To achieve the best performance when using
:parentto select elements, first select the elements using a pure CSS selector, then use
Finds all tds with children, including text.