jQuery :parentSelector

jQuery 选择器jQuery Selector

Examples

Select all <td> elements that have child elements or contain text:

$("td:parent")

Try it Yourself »

Definition and Usage

The :parent selector selects all parent elements that contain child nodes or text nodes.

:parent and:emptyare opposite.

One important thing to note is that the child elements involved in :parent (and :empty) include text nodes.


Syntax

$(":parent")


jQuery 选择器jQuery Selector

Other Extensions