jQuery :parent Selector

Instance

Select each <td> element that is a parent (contains at least one child element or text):

$(document).ready(function(){
  $("td:parent").css("background-color","yellow");
});

Try it Β»

Definition and Usage

The :parent selector selects all elements that are the parent of another element, including text nodes.

Tip: This selector is the opposite of :empty.

Note: An element is considered a parent if it contains at least one child element (including text).

Syntax

$(":parent")