Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
42 lines (38 sloc) 1.49 KB
<?xml version="1.0"?>
<entry type="selector" name="not" return="">
<title>:not() Selector</title>
<sample>:not(selector)</sample>
<signature>
<added>1.0</added>
<argument name="selector" type="Selector">
<desc>A selector with which to filter by.</desc>
</argument>
</signature>
<desc>Selects all elements that do not match the given selector.</desc>
<longdesc>
<p>All selectors are accepted inside <code>:not()</code>, for example: <code>:not(div a)</code> and <code>:not(div,a)</code>.</p>
<h3>Additional Notes</h3>
<p>The <code><a href="/not/">.not()</a></code> method will end up providing you with more readable selections than pushing complex selectors or variables into a <code>:not()</code> selector filter. In most cases, it is a better choice.</p>
</longdesc>
<example>
<desc>Finds all inputs that are not checked and highlights the next sibling span. Notice there is no change when clicking the checkboxes since no click events have been linked.</desc>
<code><![CDATA[
$("input:not(:checked) + span").css("background-color", "yellow");
$("input").attr("disabled", "disabled");
]]></code>
<html><![CDATA[<div>
<input type="checkbox" name="a" />
<span>Mary</span>
</div>
<div>
<input type="checkbox" name="b" />
<span>lcm</span>
</div>
<div>
<input type="checkbox" name="c" checked="checked" />
<span>Peter</span>
</div>]]></html>
</example>
<category slug="selectors/basic-filter-selectors"/>
<category slug="version/1.0"/>
</entry>
Jump to Line
Something went wrong with that request. Please try again.