:parent selector

:parent Selector

parent selector

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 :empty.

One important thing to note regarding the use of :parent (and :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 登录查看完整内容