Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
37 lines (37 sloc) 1.6 KB
<?xml version="1.0"?>
<entry type="selector" name="child" return="">
<title>Child Selector ("parent &gt; child")</title>
<sample>parent &gt; child</sample>
<argument name="parent" type="Selector">
<desc>Any valid selector.</desc>
<argument name="child" type="Selector">
<desc>A selector to filter the child elements.</desc>
<desc>Selects all direct child elements specified by "child" of elements specified by "parent".</desc>
<p>As a CSS selector, the child combinator is supported by all modern web browsers including Safari, Firefox, Opera, Chrome, and Internet Explorer 7 and above, but notably not by Internet Explorer versions 6 and below. However, in jQuery, this selector (along with all others) works across all supported browsers, including IE6.</p>
<p>The child combinator (E <strong>&gt;</strong> F) can be thought of as a more specific form of the descendant combinator (E F) in that it selects only first-level descendants.</p>
<desc>Places a border around all list items that are children of &lt;ul class="topnav"&gt; .</desc>
<code><![CDATA[$("ul.topnav > li").css("border", "3px double red");]]></code>
body { font-size:14px; }
<ul class="topnav">
<li>Item 1</li>
<li>Item 2
<ul><li>Nested item 1</li><li>Nested item 2</li><li>Nested item 3</li></ul>
<li>Item 3</li>
<category slug="selectors/hierarchy-selectors"/>
<category slug="version/1.0"/>
Jump to Line
Something went wrong with that request. Please try again.