forked from jquery/api.jquery.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheckbox-selector.xml
53 lines (46 loc) · 1.9 KB
/
checkbox-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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?xml version="1.0"?>
<entry type="selector" name="checkbox" return="">
<title>:checkbox Selector</title>
<sample>:checkbox</sample>
<signature>
<added>1.0</added>
</signature>
<desc>Selects all elements of type checkbox.</desc>
<longdesc>
<p><code>$(':checkbox')</code> is equivalent to <code>$('[type=checkbox]')</code>. 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>$(':checkbox')</code> is equivalent to <code>$('*:checkbox')</code>, so <code>$('input:checkbox')</code> should be used instead. </p>
</longdesc>
<note id="jquery-selector-extension-alt" type="additional" data-selector=":checkbox" data-alt="[type="checkbox"]"/>
<example>
<desc>Finds all checkbox inputs.</desc>
<code><![CDATA[
var input = $("form input:checkbox").wrap('<span></span>').parent().css({background:"yellow", border:"3px red solid"});
$("div").text("For this type jQuery found " + input.length + ".")
.css("color", "red");
$("form").submit(function () { return false; }); // so it won't submit
]]></code>
<css><![CDATA[
textarea { height:25px; }
]]></css>
<html><![CDATA[<form>
<input type="button" value="Input Button"/>
<input type="checkbox" />
<input type="checkbox" />
<input type="file" />
<input type="hidden" />
<input type="image" />
<input type="password" />
<input type="radio" />
<input type="reset" />
<input type="submit" />
<input type="text" />
<select><option>Option<option/></select>
<textarea></textarea>
<button>Button</button>
</form>
<div>
</div>]]></html>
</example>
<category slug="selectors/form-selectors"/>
<category slug="selectors/jquery-selector-extensions"/>
<category slug="version/1.0"/>
</entry>