Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

44 lines (41 sloc) 1.11 kB
<?xml version="1.0"?>
<entry type="selector" name="only-child" return="">
<title>:only-child Selector</title>
<sample>:only-child</sample>
<signature>
<added>1.1.4</added>
</signature>
<desc>Selects all elements that are the only child of their parent.</desc>
<longdesc>
<p>If the parent has other child elements, nothing is matched.</p>
</longdesc>
<example>
<desc>Change the text and add a border for each button that is the only child of its parent.</desc>
<code><![CDATA[
$("div button:only-child").text("Alone").css("border", "2px blue solid");
]]></code>
<css><![CDATA[
div { width:100px; height:80px; margin:5px; float:left; background:#b9e }
]]></css>
<html><![CDATA[<div>
<button>Sibling!</button>
<button>Sibling!</button>
</div>
<div>
<button>Sibling!</button>
</div>
<div>
None
</div>
<div>
<button>Sibling!</button>
<button>Sibling!</button>
<button>Sibling!</button>
</div>
<div>
<button>Sibling!</button>
</div>]]></html>
</example>
<category slug="selectors/child-filter-selectors"/>
<category slug="version/1.1.4"/>
</entry>
Jump to Line
Something went wrong with that request. Please try again.