forked from jquery/api.jquery.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenabled-selector.xml
28 lines (24 loc) · 1.68 KB
/
enabled-selector.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?xml version="1.0"?>
<entry type="selector" name="enabled" return="">
<title>:enabled Selector</title>
<sample>:enabled</sample>
<signature>
<added>1.0</added>
</signature>
<desc>Selects all elements that are enabled.</desc>
<longdesc>
<p>As with other pseudo-class selectors (those that begin with a ":") it is recommended to precede it with a tag name or some other selector; otherwise, the universal selector ("*") is implied. In other words, the bare <code>$(':enabled')</code> is equivalent to <code>$('*:enabled')</code>, so <code>$('input:enabled')</code> or similar should be used instead. </p>
<p>Although their resulting selections are usually the same, <code>:enabled</code> selector is subtly different from <code>:not([disabled])</code>; <code>:enabled</code> selects elements that have their boolean disabled property strictly equal to false, while <code>:not([disabled])</code> selects elements that do not have a disabled <em>attribute</em> set (regardless of its value).</p>
<p>The <code>:enabled</code> selector should only be used for selecting HTML elements that support the <code>disabled</code> attribute (<code><button></code>, <code><input></code>, <code><optgroup></code>, <code><option></code>, <code><select></code>, and <code><textarea></code>).</p>
</longdesc>
<example>
<desc>Find all input elements that are enabled.</desc>
<code><![CDATA[$("input:enabled").val("this is it");]]></code>
<html><![CDATA[<form>
<input name="email" disabled="disabled" />
<input name="id" />
</form>]]></html>
</example>
<category slug="selectors/form-selectors"/>
<category slug="version/1.0"/>
</entry>