Skip to content

Commit bdbb0f9

Browse files
committed
Merge pull request jquery-archive#2176 from ovargas27/master
Checkbox - new API docs format. Thanks ovargas27!
2 parents b7a19b6 + 0729d25 commit bdbb0f9

29 files changed

+350
-45
lines changed

docs/forms/checkboxes/events.html

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
<title>jQuery Mobile Docs - Checkboxes</title>
7+
<link rel="stylesheet" href="../../../themes/default/" />
8+
<link rel="stylesheet" href="../../_assets/css/jqm-docs.css"/>
9+
<script src="../../../js/jquery.js"></script>
10+
<script src="../../../experiments/themeswitcher/jquery.mobile.themeswitcher.js"></script>
11+
<script src="../../_assets/js/jqm-docs.js"></script>
12+
<script src="../../../js/"></script>
13+
</head>
14+
<body>
15+
16+
<div data-role="page" class="type-interior">
17+
18+
<div data-role="header" data-theme="f">
19+
<h1>Checkboxes</h1>
20+
<a href="../../../" data-icon="home" data-iconpos="notext" data-direction="reverse" class="ui-btn-right jqm-home">Home</a>
21+
</div><!-- /header -->
22+
23+
<div data-role="content">
24+
<div class="content-primary">
25+
26+
<form action="#" method="get">
27+
28+
<h2>Checkboxes</h2>
29+
30+
<ul data-role="controlgroup" data-type="horizontal" class="localnav">
31+
<li><a href="index.html" data-role="button" data-transition="fade">Basics</a></li>
32+
<li><a href="options.html" data-role="button" data-transition="fade">Options</a></li>
33+
<li><a href="methods.html" data-role="button" data-transition="fade">Methods</a></li>
34+
<li><a href="events.html" data-role="button" data-transition="fade" class="ui-btn-active">Events</a></li>
35+
</ul>
36+
37+
<p>Since the native checkbox is used as a proxy for the custom checkbox, you can watch for events on the original, native checkbox instead of needing to go through the checkbox plugin. Bind to the change event by type: change, blur, focus, keypress, click, etc.</p>
38+
<pre><code>
39+
$("input[type='checkbox']").bind( "change", function(event, ui) {
40+
...
41+
});
42+
</code></pre>
43+
44+
<p>The checkbox plugin has the following custom events:</p>
45+
46+
<dl>
47+
48+
<dt><code>create</code> triggered when a checkbox is created</dt>
49+
<dd>
50+
<p>This event is used to find out when a custom checkbox was created. It is not used to create a custom checkbox. The checkbox create event can be used like this: </p>
51+
52+
<pre><code>
53+
$("input[type='checkbox']").checkboxradio({
54+
create: function(event, ui) { ... }
55+
});
56+
</code></pre>
57+
</dd>
58+
59+
60+
</dl>
61+
62+
</form>
63+
</div><!--/content-primary -->
64+
65+
<div class="content-secondary">
66+
67+
<div data-role="collapsible" data-collapsed="true" data-theme="b">
68+
69+
<h3>More in this section</h3>
70+
71+
<ul data-role="listview" data-theme="c" data-dividertheme="d">
72+
73+
<li data-role="list-divider">Form elements</li>
74+
<li><a href="../docs-forms.html">Form basics</a></li>
75+
<li><a href="../forms-all.html">Form element gallery</a></li>
76+
<li><a href="../texts/index.html">Text inputs</a></li>
77+
<li><a href="../forms-search.html">Search inputs</a></li>
78+
<li><a href="../forms-slider.html">Slider</a></li>
79+
<li><a href="../forms-switch.html">Flip toggle switch</a></li>
80+
<li><a href="../radiobuttons/index.html">Radio buttons</a></li>
81+
<li data-theme="a"><a href="index.html">Checkboxes</a></li>
82+
<li><a href="../selects/index.html">Select menus</a></li>
83+
<li><a href="../forms-themes.html">Theming forms</a></li>
84+
<li><a href="../forms-all-native.html">Native form elements</a></li>
85+
<li><a href="../forms-sample.html">Submitting forms</a></li>
86+
<li><a href="../plugin-eventsmethods.html">Plugin methods</a></li>
87+
88+
</ul>
89+
</div>
90+
</div>
91+
92+
</div><!-- /content -->
93+
94+
<div data-role="footer" class="footer-docs" data-theme="c">
95+
<p>&copy; 2011 The jQuery Project</p>
96+
</div>
97+
98+
</div><!-- /page -->
99+
100+
</body>
101+
</html>
102+

docs/forms/forms-checkboxes.html renamed to docs/forms/checkboxes/index.html

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@
44
<meta charset="utf-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1">
66
<title>jQuery Mobile Docs - Checkboxes</title>
7-
<link rel="stylesheet" href="../../themes/default/" />
8-
<link rel="stylesheet" href="../_assets/css/jqm-docs.css"/>
9-
<script src="../../js/jquery.js"></script>
10-
<script src="../../experiments/themeswitcher/jquery.mobile.themeswitcher.js"></script>
11-
<script src="../_assets/js/jqm-docs.js"></script>
12-
<script src="../../js/"></script>
7+
<link rel="stylesheet" href="../../../themes/default/" />
8+
<link rel="stylesheet" href="../../_assets/css/jqm-docs.css"/>
9+
<script src="../../../js/jquery.js"></script>
10+
<script src="../../../experiments/themeswitcher/jquery.mobile.themeswitcher.js"></script>
11+
<script src="../../_assets/js/jqm-docs.js"></script>
12+
<script src="../../../js/"></script>
1313
</head>
1414
<body>
1515

1616
<div data-role="page" class="type-interior">
1717

1818
<div data-role="header" data-theme="f">
1919
<h1>Checkboxes</h1>
20-
<a href="../../" data-icon="home" data-iconpos="notext" data-direction="reverse" class="ui-btn-right jqm-home">Home</a>
20+
<a href="../../../" data-icon="home" data-iconpos="notext" data-direction="reverse" class="ui-btn-right jqm-home">Home</a>
2121
</div><!-- /header -->
2222

2323
<div data-role="content">
@@ -26,6 +26,14 @@ <h1>Checkboxes</h1>
2626
<form action="#" method="get">
2727

2828
<h2>Checkboxes</h2>
29+
30+
<ul data-role="controlgroup" data-type="horizontal" class="localnav">
31+
<li><a href="index.html" data-role="button" data-transition="fade" class="ui-btn-active">Basics</a></li>
32+
<li><a href="options.html" data-role="button" data-transition="fade">Options</a></li>
33+
<li><a href="methods.html" data-role="button" data-transition="fade">Methods</a></li>
34+
<li><a href="events.html" data-role="button" data-transition="fade">Events</a></li>
35+
</ul>
36+
2937
<p>Checkboxes are used to provide a list of options where more than one can be selected. Traditional desktop checkboxes are not optimized for touch input so in jQuery Mobile, we style the <code>label</code> for the checkboxes so they are larger and look clickable. A custom set of icons are added to the label to provide additional visual feedback.</p>
3038

3139
<p>Both the radio and checkbox controls below use standard input/label markup, but are styled to be more touch-friendly. The styled control you see is actually the label element, which sits over the real input, so if images fail to load, you'll still have a functional control. In most browsers, clicking the label automatically triggers a click on the input, but we've had to trigger the update manually for a few mobile browsers that don't do this natively. On the desktop, these controls are keyboard and screen-reader accessible. </p>
@@ -122,19 +130,19 @@ <h3>More in this section</h3>
122130
<ul data-role="listview" data-theme="c" data-dividertheme="d">
123131

124132
<li data-role="list-divider">Form elements</li>
125-
<li><a href="docs-forms.html">Form basics</a></li>
126-
<li><a href="forms-all.html">Form element gallery</a></li>
127-
<li><a href="texts/index.html">Text inputs</a></li>
128-
<li><a href="forms-search.html">Search inputs</a></li>
129-
<li><a href="forms-slider.html">Slider</a></li>
130-
<li><a href="forms-switch.html">Flip toggle switch</a></li>
131-
<li><a href="radiobuttons/index.html">Radio buttons</a></li>
132-
<li data-theme="a"><a href="forms-checkboxes.html">Checkboxes</a></li>
133-
<li><a href="selects/index.html">Select menus</a></li>
134-
<li><a href="forms-themes.html">Theming forms</a></li>
135-
<li><a href="forms-all-native.html">Native form elements</a></li>
136-
<li><a href="forms-sample.html">Submitting forms</a></li>
137-
<li><a href="plugin-eventsmethods.html">Plugin methods</a></li>
133+
<li><a href="../docs-forms.html">Form basics</a></li>
134+
<li><a href="../forms-all.html">Form element gallery</a></li>
135+
<li><a href="../texts/index.html">Text inputs</a></li>
136+
<li><a href="../forms-search.html">Search inputs</a></li>
137+
<li><a href="../forms-slider.html">Slider</a></li>
138+
<li><a href="../forms-switch.html">Flip toggle switch</a></li>
139+
<li><a href="../radiobuttons/index.html">Radio buttons</a></li>
140+
<li data-theme="a"><a href="index.html">Checkboxes</a></li>
141+
<li><a href="../selects/index.html">Select menus</a></li>
142+
<li><a href="../forms-themes.html">Theming forms</a></li>
143+
<li><a href="../forms-all-native.html">Native form elements</a></li>
144+
<li><a href="../forms-sample.html">Submitting forms</a></li>
145+
<li><a href="../plugin-eventsmethods.html">Plugin methods</a></li>
138146

139147
</ul>
140148
</div>

docs/forms/checkboxes/methods.html

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
<title>jQuery Mobile Docs - Checkboxes</title>
7+
<link rel="stylesheet" href="../../../themes/default/" />
8+
<link rel="stylesheet" href="../../_assets/css/jqm-docs.css"/>
9+
<script src="../../../js/jquery.js"></script>
10+
<script src="../../../experiments/themeswitcher/jquery.mobile.themeswitcher.js"></script>
11+
<script src="../../_assets/js/jqm-docs.js"></script>
12+
<script src="../../../js/"></script>
13+
</head>
14+
<body>
15+
16+
<div data-role="page" class="type-interior">
17+
18+
<div data-role="header" data-theme="f">
19+
<h1>Checkboxes</h1>
20+
<a href="../../../" data-icon="home" data-iconpos="notext" data-direction="reverse" class="ui-btn-right jqm-home">Home</a>
21+
</div><!-- /header -->
22+
23+
<div data-role="content">
24+
<div class="content-primary">
25+
26+
<form action="#" method="get">
27+
28+
<h2>Checkboxes</h2>
29+
30+
<ul data-role="controlgroup" data-type="horizontal" class="localnav">
31+
<li><a href="index.html" data-role="button" data-transition="fade">Basics</a></li>
32+
<li><a href="options.html" data-role="button" data-transition="fade">Options</a></li>
33+
<li><a href="methods.html" data-role="button" data-transition="fade" class="ui-btn-active">Methods</a></li>
34+
<li><a href="events.html" data-role="button" data-transition="fade">Events</a></li>
35+
</ul>
36+
37+
<p>The checkbox has the following methods:</p>
38+
39+
<dl>
40+
41+
<dt><code>enable</code> enable a disabled checkbox</dt>
42+
<dd>
43+
<pre><code>
44+
$("input[type='checkbox']").checkboxradio('enable');
45+
</code></pre>
46+
</dd>
47+
48+
<dt><code>disable</code> disable a select.</dt>
49+
<dd>
50+
<pre><code>
51+
$("input[type='checkbox']").checkboxradio('disable');
52+
</code></pre>
53+
</dd>
54+
55+
<dt><code>refresh</code> update the custom select</dt>
56+
<dd>
57+
If you manipulate a checkbox via JavaScript, you must call the refresh method on it to update the visual styling.
58+
<pre><code>
59+
$("input[type='checkbox']:first").attr("checked",true).checkboxradio("refresh");
60+
</code></pre>
61+
</dd>
62+
63+
</dl>
64+
65+
</form>
66+
</div><!--/content-primary -->
67+
68+
<div class="content-secondary">
69+
70+
<div data-role="collapsible" data-collapsed="true" data-theme="b">
71+
72+
<h3>More in this section</h3>
73+
74+
<ul data-role="listview" data-theme="c" data-dividertheme="d">
75+
76+
<li data-role="list-divider">Form elements</li>
77+
<li><a href="../docs-forms.html">Form basics</a></li>
78+
<li><a href="../forms-all.html">Form element gallery</a></li>
79+
<li><a href="../texts/index.html">Text inputs</a></li>
80+
<li><a href="../forms-search.html">Search inputs</a></li>
81+
<li><a href="../forms-slider.html">Slider</a></li>
82+
<li><a href="../forms-switch.html">Flip toggle switch</a></li>
83+
<li><a href="../radiobuttons/index.html">Radio buttons</a></li>
84+
<li data-theme="a"><a href="index.html">Checkboxes</a></li>
85+
<li><a href="../selects/index.html">Select menus</a></li>
86+
<li><a href="../forms-themes.html">Theming forms</a></li>
87+
<li><a href="../forms-all-native.html">Native form elements</a></li>
88+
<li><a href="../forms-sample.html">Submitting forms</a></li>
89+
<li><a href="../plugin-eventsmethods.html">Plugin methods</a></li>
90+
91+
</ul>
92+
</div>
93+
</div>
94+
95+
</div><!-- /content -->
96+
97+
<div data-role="footer" class="footer-docs" data-theme="c">
98+
<p>&copy; 2011 The jQuery Project</p>
99+
</div>
100+
101+
</div><!-- /page -->
102+
103+
</body>
104+
</html>
105+

docs/forms/checkboxes/options.html

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
<title>jQuery Mobile Docs - Checkboxes</title>
7+
<link rel="stylesheet" href="../../../themes/default/" />
8+
<link rel="stylesheet" href="../../_assets/css/jqm-docs.css"/>
9+
<script src="../../../js/jquery.js"></script>
10+
<script src="../../../experiments/themeswitcher/jquery.mobile.themeswitcher.js"></script>
11+
<script src="../../_assets/js/jqm-docs.js"></script>
12+
<script src="../../../js/"></script>
13+
</head>
14+
<body>
15+
16+
<div data-role="page" class="type-interior">
17+
18+
<div data-role="header" data-theme="f">
19+
<h1>Checkboxes</h1>
20+
<a href="../../../" data-icon="home" data-iconpos="notext" data-direction="reverse" class="ui-btn-right jqm-home">Home</a>
21+
</div><!-- /header -->
22+
23+
<div data-role="content">
24+
<div class="content-primary">
25+
26+
<form action="#" method="get">
27+
28+
<h2>Checkboxes</h2>
29+
30+
<ul data-role="controlgroup" data-type="horizontal" class="localnav">
31+
<li><a href="index.html" data-role="button" data-transition="fade">Basics</a></li>
32+
<li><a href="options.html" data-role="button" data-transition="fade" class="ui-btn-active">Options</a></li>
33+
<li><a href="methods.html" data-role="button" data-transition="fade">Methods</a></li>
34+
<li><a href="events.html" data-role="button" data-transition="fade">Events</a></li>
35+
</ul>
36+
37+
<p>The checkbox has the following options:</p>
38+
39+
<dl>
40+
41+
<dt><code>theme</code> <em>string</em></dt>
42+
<dd>
43+
<p class="default">default: null, inherited from parent</p>
44+
<p>Sets the theme swatch color scheme for the checkbox. This is a single letter from a-z that maps to the swatches included in your theme. By default, a checkbox will inherit the same swatch color as it's parent container if not explicitly set. This option is also exposed as a data attribute: <code>data-theme=&quot;a&quot;</code></p>
45+
<pre><code>$("input[type='checkbox'").checkboxradio(<strong>{ theme: "a" }</strong>);</code></pre>
46+
</dd>
47+
48+
</dl>
49+
50+
</form>
51+
</div><!--/content-primary -->
52+
53+
<div class="content-secondary">
54+
55+
<div data-role="collapsible" data-collapsed="true" data-theme="b">
56+
57+
<h3>More in this section</h3>
58+
59+
<ul data-role="listview" data-theme="c" data-dividertheme="d">
60+
61+
<li data-role="list-divider">Form elements</li>
62+
<li><a href="../docs-forms.html">Form basics</a></li>
63+
<li><a href="../forms-all.html">Form element gallery</a></li>
64+
<li><a href="../texts/index.html">Text inputs</a></li>
65+
<li><a href="../forms-search.html">Search inputs</a></li>
66+
<li><a href="../forms-slider.html">Slider</a></li>
67+
<li><a href="../forms-switch.html">Flip toggle switch</a></li>
68+
<li><a href="../radiobuttons/index.html">Radio buttons</a></li>
69+
<li data-theme="a"><a href="index.html">Checkboxes</a></li>
70+
<li><a href="../selects/index.html">Select menus</a></li>
71+
<li><a href="../forms-themes.html">Theming forms</a></li>
72+
<li><a href="../forms-all-native.html">Native form elements</a></li>
73+
<li><a href="../forms-sample.html">Submitting forms</a></li>
74+
<li><a href="../plugin-eventsmethods.html">Plugin methods</a></li>
75+
76+
</ul>
77+
</div>
78+
</div>
79+
80+
</div><!-- /content -->
81+
82+
<div data-role="footer" class="footer-docs" data-theme="c">
83+
<p>&copy; 2011 The jQuery Project</p>
84+
</div>
85+
86+
</div><!-- /page -->
87+
88+
</body>
89+
</html>
90+

docs/forms/docs-forms.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ <h3>More in this section</h3>
133133
<li><a href="forms-slider.html">Slider</a></li>
134134
<li><a href="forms-switch.html">Flip toggle switch</a></li>
135135
<li><a href="radiobuttons/index.html">Radio buttons</a></li>
136-
<li><a href="forms-checkboxes.html">Checkboxes</a></li>
136+
<li><a href="checkboxes/index.html">Checkboxes</a></li>
137137
<li><a href="selects/index.html">Select menus</a></li>
138138
<li><a href="forms-themes.html">Theming forms</a></li>
139139
<li><a href="forms-all-native.html">Native form elements</a></li>

docs/forms/forms-all-native.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ <h3>More in this section</h3>
223223
<li><a href="forms-slider.html">Slider</a></li>
224224
<li><a href="forms-switch.html">Flip toggle switch</a></li>
225225
<li><a href="radiobuttons/index.html">Radio buttons</a></li>
226-
<li><a href="forms-checkboxes.html">Checkboxes</a></li>
226+
<li><a href="checkboxes/index.html">Checkboxes</a></li>
227227
<li><a href="selects/index.html">Select menus</a></li>
228228
<li><a href="forms-themes.html">Theming forms</a></li>
229229
<li data-theme="a"><a href="forms-all-native.html">Native form elements</a></li>

0 commit comments

Comments
 (0)