This repository has been archived by the owner on Oct 8, 2021. It is now read-only.
/
plugin-eventsmethods.html
executable file
·182 lines (140 loc) · 5.01 KB
/
plugin-eventsmethods.html
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>jQuery Mobile Docs - Form Plugin Methods</title>
<link rel="stylesheet" href="../../themes/default/" />
<link rel="stylesheet" href="../_assets/css/jqm-docs.css"/>
<script src="../../js/jquery.js"></script>
<script src="../../js/"></script>
</head>
<body>
<div data-role="page">
<div data-role="header" data-theme="b">
<h1>Form Plugin Methods</h1>
<a href="../../" data-icon="home" data-iconpos="notext" data-direction="reverse" class="ui-btn-right jqm-home">Home</a>
</div><!-- /header -->
<div data-role="content">
<p>After jQuery Mobile auto-enhances form controls into custom controls, you can manipulate many of their properties via plugin methods. The currently available methods are listed below. Check Github for updates - we're working on complete coverage.</p>
<h2>Selectmenu</h2>
<dl>
<dt>Methods</dt>
<dd><code>open</code> open a closed select menu</dd>
<dd>
<pre><code>
$('select').selectmenu('open');
</code></pre>
</dd>
<dd><code>close</code> close an open select menu</dd>
<dd>
<pre><code>
$('select').selectmenu('close');
</code></pre>
</dd>
<dd><code>refresh</code>: Update the custom menu to reflect the native select element's value. If the number of options in the select are different than the number of items in the custom menu, it'll rebuild the custom menu. Also, if you pass a true argument you can force the rebuild to happen.</dd>
<dd>
<pre><code>
//refresh value
$('select').selectmenu('refresh');
//refresh and force rebuild
$('select').selectmenu('refresh', true);
</code></pre>
</dd>
<dd><code>enable</code>: enable a disabled select.</dd>
<dd>
<pre><code>
$('select').selectmenu('enable');
</code></pre>
</dd>
<dd><code>disable</code>: disable a select.</dd>
<dd>
<pre><code>
$('select').selectmenu('disable');
</code></pre>
</dd>
</dl>
<h2>Textinput</h2>
<dl>
<dt>Methods</dt>
<dd><code>enable</code>: enable a disabled textinput/textarea.</dd>
<dd>
<pre><code>
$('input').textinput('enable');
</code></pre>
</dd>
<dd><code>disable</code>: disable a textinput/textarea.</dd>
<dd>
<pre><code>
$('textarea').textinput('disable');
</code></pre>
</dd>
</dl>
<h2>checkboxradio</h2>
<dl>
<dt>Methods</dt>
<dd><code>enable</code>: enable a disabled checkboxradio.</dd>
<dd>
<pre><code>
$('input').checkboxradio('enable');
</code></pre>
</dd>
<dd><code>disable</code>: disable a checkboxradio.</dd>
<dd>
<pre><code>
$('input').checkboxradio('disable');
</code></pre>
</dd>
<dd><code>refresh</code>: refresh a checkboxradio's value.</dd>
<dd>
<pre><code>
$('input').checkboxradio('refresh');
</code></pre>
</dd>
</dl>
<h2>slider</h2>
<dl>
<dt>Methods</dt>
<dd><code>enable</code>: enable a disabled slider.</dd>
<dd>
<pre><code>
$('input').slider('enable');
</code></pre>
</dd>
<dd><code>disable</code>: disable a slider.</dd>
<dd>
<pre><code>
$('input').slider('disable');
</code></pre>
</dd>
<dd><code>refresh</code>: refresh a slider's value.</dd>
<dd>
<pre><code>
$('input').slider('refresh');
</code></pre>
</dd>
</dl>
<h2>Form buttons</h2>
<dl>
<dt>Methods</dt>
<dd><code>enable</code>: enable a disabled button.</dd>
<dd>
<pre><code>
$('input').button('enable');
</code></pre>
</dd>
<dd><code>disable</code>: disable a slider.</dd>
<dd>
<pre><code>
$('input').button('disable');
</code></pre>
</dd>
</dl>
<h2>Degraded Form Input Types</h2>
<p>jQuery Mobile degrades several HTML5 input types back to type=text, or type=number after adding enhanced controls. For example, inputs with a type of range are enhanced with a custom slider control, and their type is set to number to offer a usable form input alongside that slider. Inputs with a type of search are degraded back to type=text after we add our own themable search input styling.</p>
<p>The page plugin contains a list of input types that are set to either true which means they'll degrade to type=text, false which means they'll be left alone, or a string such as "number", which means they'll be converted to that type (such as the case of type=range).</p>
<p>You can configure which types are changed via the page plugin's <code>degradeInputs</code> option, which can be manipulated externally via <code>$.mobile.page.prototype.options.degradeInputs</code>, which has properties: color, date, datetime, "datetime-local", email, month, number, range, search, tel, time, url, and week. Be sure to configure this inside an event handler bound to the <code>mobileinit</code> event, so that it applies to the first page as well as subsequent pages that are loaded.</p>
</div><!-- /content -->
</div><!-- /page -->
</body>
</html>