Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

29 lines (29 sloc) 1.575 kb
<?xml version="1.0"?>
<entry type="selector" name="parent" return="">
<title>:parent Selector</title>
<desc>Select all elements that that have at least one child node (either an element or text).</desc>
<p>This is the inverse of <code>:empty</code>. </p>
<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>
<p>The W3C recommends that the <code>&lt;p&gt;</code> element have at least one child node, even if that child is merely text (see <a href=""></a>). Some other elements, on the other hand, are empty (i.e. have no children) by definition:<code> &lt;input&gt;</code>, <code>&lt;img&gt;</code>, <code>&lt;br&gt;</code>, and <code>&lt;hr&gt;</code>, for example.</p>
<note id="jquery-selector-extension" type="additional" data-selector=":parent"/>
<desc>Finds all tds with children, including text.</desc>
<code><![CDATA[$("td:parent").fadeTo(1500, 0.3);]]></code>
td { width:40px; background:green; }
<html><![CDATA[<table border="1">
<tr><td>Value 1</td><td></td></tr>
<tr><td>Value 2</td><td></td></tr>
<category slug="selectors/content-filter-selector"/>
<category slug="selectors/jquery-selector-extensions"/>
<category slug="version/1.0"/>
Jump to Line
Something went wrong with that request. Please try again.