2.0_beta sync to rsa
[framework/web/web-ui-fw.git] / libs / js / jquery-mobile-1.1.0 / docs / api / data-attributes.html
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 - Data Attribute Reference</title>
7         <link rel="stylesheet"  href="../../css/themes/default/jquery.mobile.css" />
8         <link rel="stylesheet" href="../_assets/css/jqm-docs.css"/>
9
10         <script src="../../js/jquery.js"></script>
11         <script src="../../docs/_assets/js/jqm-docs.js"></script>
12         <script src="../../js/"></script>
13
14 </head>
15 <body>
16
17 <div data-role="page" class="type-interior">
18
19         <div data-role="header" data-theme="f">
20                 <h1>Data Attributes</h1>
21                 <a href="../../" data-icon="home" data-iconpos="notext" data-direction="reverse">Home</a>
22                 <a href="../nav.html" data-icon="search" data-iconpos="notext" data-rel="dialog" data-transition="fade">Search</a>
23         </div><!-- /header -->
24
25         <div data-role="content" data-theme="c">
26
27                 <div class="content-primary">
28                         <h2>Data- attribute reference</h2>
29                         <p>The jQuery Mobile framework uses HTML5 <code>data-</code> attributes to allow for markup-based initialization and configuration of widgets. These attributes are completely optional; calling plugins manually and passing options directly is also supported. To avoid naming conflicts with other plugins or frameworks that also use <code>data-</code> attributes, set a custom namespace by modifying the <a href="globalconfig.html"><code>ns</code> global option</a>.<p>
30
31                                 <style>
32                                         table { width:100%; border-bottom:1px solid #ccc; }
33                                         th { text-align:left; width: 170px; }
34                                         th, td { vertical-align:top; border-top:1px solid #ccc; padding: 6px 10px 4px 0; }
35                                 </style>
36
37                         <h2><a href="../buttons/buttons-types.html">Button</a></h2>
38                         <p>Links with <code>data-role="button"</code>. Input-based buttons and button elements are auto-enhanced, no <code>data-role</code> required</p>
39                         <table>
40                                 <tr>
41                                         <th>data-corners</th>
42                                         <td><strong>true</strong> | false</td>
43                                 </tr>
44                                 <tr>
45                                         <th>data-icon</th>
46                                         <td>home | delete | plus | arrow-u | arrow-d | check | gear | grid | star | custom | arrow-r | arrow-l | minus | refresh | forward | back | alert | info | search</td>
47                                 </tr>
48                                 <tr>
49                                         <th>data-iconpos</th>
50                                         <td><strong>left</strong> | right | top | bottom |  notext</td>
51                                 </tr>
52                                 <tr>
53                                         <th>data-iconshadow</th>
54                                         <td><strong>true</strong> | false</td>
55                                 </tr>
56                                 <tr>
57                                         <th>data-inline</th>
58                                         <td>true | <strong>false</strong></td>
59                                 </tr>
60                                 <tr>
61                                         <th>data-mini</th>
62                                         <td>true | <strong>false</strong> - Compact sized version</td>
63                                 </tr>
64                                 <tr>
65                                         <th>data-shadow</th>
66                                         <td><strong>true</strong> | false</td>
67                                 </tr>
68                                 <tr>
69                                         <th>data-theme</th>
70                                         <td>swatch letter (a-z)</td>
71                                 </tr>
72                         </table>
73                         <p>Multiple buttons can be wrapped in a container with a <code>data-role="controlgroup"</code> attribute for a vertically grouped set. Add the <code>data-type="horizontal"</code> attribute for the buttons to sit side-by-side.</p>
74
75
76                         <h2><a href="../forms/checkboxes/">Checkbox</a></h2>
77                         <p>Pairs of labels and inputs with <code>type="checkbox"</code> are auto-enhanced, no <code>data-role</code> required</p>
78                         <table>
79                                 <tr>
80                                         <th>data-mini</th>
81                                         <td>true | <strong>false</strong> - Compact sized version</td>
82                                 </tr>
83                                 <tr>
84                                         <th>data-role</th>
85                                         <td>none (prevents auto-enhancement to use native control)</td>
86                                 </tr>
87                                 <tr>
88                                         <th>data-theme</th>
89                                         <td>swatch letter (a-z) - Added to the form element</td>
90                                 </tr>
91                         </table>
92
93                         <h2><a href="../content/content-collapsible.html">Collapsible</a></h2>
94                         <p>A heading and content wrapped in a container with the <code>data-role="collapsible"</code></p>
95                         <table>
96                                 <tr>
97                                         <th>data-collapsed</th>
98                                         <td><strong>true</strong> | false</td>
99                                 </tr>
100                                 <tr>
101                                         <th>data-content-theme</th>
102                                         <td>swatch letter (a-z)</td>
103                                 </tr>
104                                 <tr>
105                                         <th>data-iconpos</th>
106                                         <td><strong>left</strong> | right | top | bottom |  notext</td>
107                                 </tr>
108                                 <tr>
109                                         <th>data-mini</th>
110                                         <td>true | <strong>false</strong> - Compact sized version</td>
111                                 </tr>
112                                 <tr>
113                                         <th>data-theme</th>
114                                         <td>swatch letter (a-z)</td>
115                                 </tr>
116                         </table>
117
118                         <h2><a href="../content/content-collapsible-set.html">Collapsible set</a></h2>
119                         <p>A number of collapsibles wrapped in a container with the <code>data-role="collapsible-set"</code></p>
120                         <table>
121                                 <tr>
122                                         <th>data-content-theme</th>
123                                         <td>swatch letter (a-z) - Sets all collapsibles in set</td>
124                                 </tr>
125                                 <tr>
126                                         <th>data-iconpos</th>
127                                         <td><strong>left</strong> | right | top | bottom |  notext</td>
128                                 </tr>
129                                 <tr>
130                                         <th>data-mini</th>
131                                         <td>true | <strong>false</strong> - Compact sized version</td>
132                                 </tr>
133                                 <tr>
134                                         <th>data-theme</th>
135                                         <td>swatch letter (a-z) - Sets all collapsibles in set</td>
136                                 </tr>
137                         </table>
138
139                         <h2><a href="../pages/page-anatomy.html">Content</a></h2>
140                         <p>Container with <code>data-role="content"</code></p>
141                         <table>
142                                 <tr>
143                                         <th>data-theme</th>
144                                         <td>swatch letter (a-z)</td>
145                                 </tr>
146                         </table>
147
148                         <h2><a href="../pages/page-dialogs.html">Dialog</a></h2>
149                         <p>Page with <code>data-role="page"</code> linked to with <code>data-rel="dialog"</code> on the anchor.</p>
150                         <table>
151                                 <tr>
152                                         <th>data-close-btn-text</th>
153                                         <td>string (text for the close button, dialog only)</td>
154                                 </tr>
155                                 <tr>
156                                         <th>data-dom-cache</th>
157                                         <td>true | <strong>false</strong></td>
158                                 </tr>
159                                 <tr>
160                                         <th>data-overlay-theme</th>
161                                         <td>swatch letter (a-z) - overlay theme when the page is opened in a dialog</td>
162                                 </tr>
163                                 <tr>
164                                         <th>data-theme</th>
165                                         <td>swatch letter (a-z)</td>
166                                 </tr>
167                                 <tr>
168                                         <th>data-title</th>
169                                         <td>string (title used when page is shown)</td>
170                                 </tr>
171                         </table>
172
173                         <h2><a href="globalconfig.html">Enhancement</a></h2>
174                         <p>Container with <code>data-enhance="false"</code> or <code>data-ajax="false"</code></p>
175                         <table>
176                                 <tr>
177                                         <th>data-enhance</th>
178                                         <td><strong>true</strong> | false</td>
179                                 </tr>
180                                 <tr>
181                                         <th>data-ajax</th>
182                                         <td><strong>true</strong> | false</td>
183                                 </tr>
184                         </table>
185                         <p>Any DOM elements inside a <code>data-enhance="false"</code> container, save for <code>data-role="page|dialog"</code> elements, will be ignored during initial enhancement and subsequent <code>create</code> events provided that the <code>$.mobile.ignoreContentEnabled</code> flag is set prior to the enhancement (eg in a <code>mobileinit</code> binding).</p>
186
187                         <p>Any link or form elements inside <code>data-enhance="false"</code> containers will be ignored by the framework's navigation functionality when <code>$.mobile.ignoreContentEnabled</code> is set to true.</p>
188
189                         <h2><a href="../forms/docs-forms.html">Field container</a></h2>
190                         <p>Container with <code>data-role="fieldcontain"</code> wrapped around label/form element pair</p>
191
192                         <h2><a href="../forms/switch/">Flip toggle switch</a></h2>
193                         <p>Select with <code>data-role="slider"</code>, two options only</p>
194                         <table>
195                                 <tr>
196                                         <th>data-mini</th>
197                                         <td>true | <strong>false</strong> - Compact sized version</td>
198                                 </tr>
199                                 <tr>
200                                         <th>data-role</th>
201                                         <td>none (prevents auto-enhancement to use native control)</td>
202                                 </tr>
203                                 <tr>
204                                         <th>data-theme</th>
205                                         <td>swatch letter (a-z) - Added to the form element</td>
206                                 </tr>
207                                 <tr>
208                                         <th>data-track-theme</th>
209                                         <td>swatch letter (a-z) - Added to the form element</td>
210                                 </tr>
211                         </table>
212
213                         <h2><a href="../toolbars/docs-footers.html">Footer</a></h2>
214                         <p>Container with <code>data-role="footer"</code></p>
215                         <table>
216                                 <tr>
217                                         <th>data-id</th>
218                                         <td>string (unique id, useful in persistent footers)</td>
219                                 </tr>
220                                 <tr>
221                                         <th>data-position</th>
222                                         <td>fixed</td>
223                                 </tr>
224                                 <tr>
225                                         <th>data-fullscreen</th>
226                                         <td>true (used in conjunction with fixed toolbars)</td>
227                                 </tr>
228                                 <tr>
229                                         <th>data-theme</th>
230                                         <td>swatch letter (a-z)</td>
231                                 </tr>
232                         </table>
233
234                         <h2><a href="../toolbars/docs-headers.html">Header</a></h2>
235                         <p>Container with <code>data-role="header"</code></p>
236                         <table>
237                                 <tr>
238                                         <th>data-position</th>
239                                         <td>fixed</td>
240                                 </tr>
241                                 <tr>
242                                         <th>data-fullscreen</th>
243                                         <td>true (used in conjunction with fixed toolbars)</td>
244                                 </tr>
245                                 <tr>
246                                         <th>data-theme</th>
247                                         <td>swatch letter (a-z)</td>
248                                 </tr>
249                         </table>
250
251                         <h2><a href="../pages/page-links.html">Link</a></h2>
252                         <p>Links, including those with a <code>data-role="button"</code>, and form submit buttons share these attributes</p>
253                         <table>
254                                 <tr>
255                                         <th>data-ajax</th>
256                                         <td><strong>true</strong> | false</td>
257                                 </tr>
258                                 <tr>
259                                         <th>data-direction</th>
260                                         <td>reverse (reverse page transition animation)</td>
261                                 </tr>
262                                 <tr>
263                                         <th>data-dom-cache</th>
264                                         <td>true | <strong>false</strong></td>
265                                 </tr>
266                                 <tr>
267                                         <th>data-prefetch</th>
268                                         <td>true | <strong>false</strong></td>
269                                 </tr>
270                                 <tr>
271                                         <th>data-rel</th>
272                                         <td>back (to move one step back in history)<br />
273                                                 dialog (to open link styled as dialog, not tracked in history)<br />
274                                                 external (for linking to another domain)</td>
275                                 </tr>
276                                 <tr>
277                                         <th>data-transition</th>
278                                         <td><strong>slide</strong> | slideup | slidedown | pop | fade | flip</td>
279                                 </tr>
280                         </table>
281
282                         <h2><a href="../lists/docs-lists.html">Listview</a></h2>
283                         <p>OL or UL with <code>data-role="listview"</code></p>
284                         <table>
285                                 <tr>
286                                         <th>data-count-theme</th>
287                                         <td>swatch letter (a-z)</td>
288                                 </tr>
289                                 <tr>
290                                         <th>data-divider-theme</th>
291                                         <td>swatch letter (a-z)</td>
292                                 </tr>
293                                 <tr>
294                                         <th>data-filter</th>
295                                         <td>true | <strong>false</strong></td>
296                                 </tr>
297                                 <tr>
298                                         <th>data-filter-placeholder</th>
299                                         <td>string</td>
300                                 </tr>
301                                 <tr>
302                                         <th>data-filter-theme</th>
303                                         <td>swatch letter (a-z)</td>
304                                 </tr>
305                                 <tr>
306                                         <th>data-inset</th>
307                                         <td>true | <strong>false</strong></td>
308                                 </tr>
309                                 <tr>
310                                         <th>data-split-icon</th>
311                                         <td>home | delete | plus | arrow-u | arrow-d | check | gear | grid | star | custom | arrow-r | arrow-l | minus | refresh | forward | back | alert | info | search</td>
312                                 </tr>
313                                 <tr>
314                                         <th>data-split-theme</th>
315                                         <td>swatch letter (a-z)<td>
316                                 </tr>
317                                 <tr>
318                                         <th>data-theme</th>
319                                         <td>swatch letter (a-z)</td>
320                                 </tr>
321                         </table>
322
323                         <h2><a href="../lists/docs-lists.html">Listview item</a></h2>
324                         <p>LI within a listview</p>
325                         <table>
326                                 <tr>
327                                         <th>data-filtertext</th>
328                                         <td>string (filter by this value instead of inner text)</td>
329                                 </tr>
330                                 <tr>
331                                         <th>data-icon</th>
332                                         <td>home | delete | plus | arrow-u | arrow-d | check | gear | grid | star | custom | arrow-r | arrow-l | minus | refresh | forward | back | alert | info | search</td>
333                                 </tr>
334                                 <tr>
335                                         <th>data-role</th>
336                                         <td>list-divider</td>
337                                 </tr>
338                                 <tr>
339                                         <th>data-theme</th>
340                                         <td>swatch letter (a-z) - can also be set on individual LIs</td>
341                                 </tr>
342                         </table>
343                         <h2><a href="../toolbars/docs-navbar.html">Navbar</a></h2>
344                         <p>A number of LIs wrapped in a container with <code>data-role="navbar"</code></p>
345                         <table>
346                                 <tr>
347                                         <th>data-icon</th>
348                                         <td>home | delete | plus | arrow-u | arrow-d | check | gear | grid | star | custom | arrow-r | arrow-l | minus | refresh | forward | back | alert | info | search</td>
349                                 </tr>
350                                 <tr>
351                                         <th>data-iconpos</th>
352                                         <td><strong>left</strong> | right | top | bottom |  notext</td>
353                                 </tr>
354                                 <tr>
355                                         <th>data-theme</th>
356                                         <td>swatch letter (a-z) - can also be set on individual LIs</td>
357                                 </tr>
358                         </table>
359                         <h2><a href="../pages/page-anatomy.html">Page</a></h2>
360                         <p>Container with <code>data-role="page"</code></p>
361                         <table>
362                                 <tr>
363                                         <th>data-add-back-btn</th>
364                                         <td>true | <strong>false</strong> (auto add back button, header only)</td>
365                                 </tr>
366                                 <tr>
367                                         <th>data-back-btn-text</th>
368                                         <td>string</td>
369                                 </tr>
370                                 <tr>
371                                         <th>data-back-btn-theme</th>
372                                         <td>swatch letter (a-z)</td>
373                                 </tr>
374                                 <tr>
375                                         <th>data-close-btn-text</th>
376                                         <td>string (text for the close button, dialog only)</td>
377                                 </tr>
378                                 <tr>
379                                         <th>data-dom-cache</th>
380                                         <td>true | <strong>false</strong></td>
381                                 </tr>
382                                 <tr>
383                                         <th>data-fullscreen</th>
384                                         <td>true (used in conjunction with fixed toolbars) <p class="ui-bar-e">Deprecated in 1.1 - use on header and footer instead.</p></td>
385                                 </tr>
386                                 <tr>
387                                         <th>data-overlay-theme</th>
388                                         <td>swatch letter (a-z) - overlay theme when the page is opened in a dialog</td>
389                                 </tr>
390                                 <tr>
391                                         <th>data-theme</th>
392                                         <td>swatch letter (a-z)</td>
393                                 </tr>
394                                 <tr>
395                                         <th>data-title</th>
396                                         <td>string (title used when page is shown)</td>
397                                 </tr>
398                         </table>
399
400                         <h2><a href="../forms/radiobuttons/">Radio button</a></h2>
401                         <p>Pairs of labels and inputs with <code>type="radio"</code> are auto-enhanced, no <code>data-role</code> required</p>
402                         <table>
403                                 <tr>
404                                         <th>data-mini</th>
405                                         <td>true | <strong>false</strong> - Compact sized version</td>
406                                 </tr>
407                                 <tr>
408                                         <th>data-role</th>
409                                         <td>none (prevents auto-enhancement to use native control)</td>
410                                 </tr>
411                                 <tr>
412                                         <th>data-theme</th>
413                                         <td>swatch letter (a-z) - Added to the form element</td>
414                                 </tr>
415                         </table>
416
417                         <h2><a href="../forms/selects/">Select</a></h2>
418                         <p>All <code>select</code> form elements are auto-enhanced, no <code>data-role</code> required</p>
419                         <table>
420                                 <tr>
421                                         <th>data-icon</th>
422                                         <td>home | delete | plus | arrow-u | arrow-d | check | gear | grid | star | custom | arrow-r | arrow-l | minus | refresh | forward | back | alert | info | search</td>
423                                 </tr>
424                                 <tr>
425                                         <th>data-iconpos</th>
426                                         <td><strong>left</strong> | right | top | bottom |  notext</td>
427                                 </tr>
428                                 <tr>
429                                         <th>data-inline</th>
430                                         <td>true | <strong>false</strong></td>
431                                 </tr>
432                                 <tr>
433                                         <th>data-mini</th>
434                                         <td>true | <strong>false</strong> - Compact sized version</td>
435                                 </tr>
436                                 <tr>
437                                         <th>data-native-menu</th>
438                                         <td><strong>true</strong> | false</td>
439                                 </tr>
440                                 <tr>
441                                         <th>data-overlay-theme</th>
442                                         <td>swatch letter (a-z) - overlay theme for non-native selects</td>
443                                 </tr>
444                                 <tr>
445                                         <th>data-placeholder</th>
446                                         <td>true | false - Add to the Option</td>
447                                 </tr>
448                                 <tr>
449                                         <th>data-role</th>
450                                         <td>none (prevents auto-enhancement to use native control)</td>
451                                 </tr>
452                                 <tr>
453                                         <th>data-theme</th>
454                                         <td>swatch letter (a-z) - Added to the form element</td>
455                                 </tr>
456                         </table>
457                         <p>Multiple selects can be wrapped in a fieldset with a <code>data-role="controlgroup"</code> attribute for a vertically grouped set. Add the <code>data-type="horizontal"</code> attribute for the selects to sit side-by-side.</p>
458
459                         <h2><a href="../forms/slider/">Slider</a></h2>
460                         <p>Inputs with <code>type="range"</code> are auto-enhanced, no <code>data-role</code> required</p>
461                         <table>
462                                 <tr>
463                                         <th>data-highlight</th>
464                                         <td>true | <strong>false</strong> - Adds an active state fill on track to handle</td>
465                                 </tr>
466                                 <tr>
467                                         <th>data-mini</th>
468                                         <td>true | <strong>false</strong> - Compact sized version</td>
469                                 </tr>
470                                 <tr>
471                                         <th>data-role</th>
472                                         <td>none (prevents auto-enhancement to use native control)</td>
473                                 </tr>
474                                 <tr>
475                                         <th>data-theme</th>
476                                         <td>swatch letter (a-z) - Added to the form element</td>
477                                 </tr>
478                                 <tr>
479                                         <th>data-track-theme</th>
480                                         <td>swatch letter (a-z) - Added to the form element</td>
481                                 </tr>
482                         </table>
483
484                         <h2><a href="../forms/textinputs/">Text input &amp; Textarea</a></h2>
485                         <p>Input <code>type="text|number|search|etc."</code> or <code>textarea</code> elements are auto-enhanced, no <code>data-role</code> required</p>
486                         <table>
487                                 <tr>
488                                         <th>data-mini</th>
489                                         <td>true | <strong>false</strong> - Compact sized version</td>
490                                 </tr>
491                                 <tr>
492                                         <th>data-role</th>
493                                         <td>none (prevents auto-enhancement to use native control)</td>
494                                 </tr>
495                                 <tr>
496                                         <th>data-theme</th>
497                                         <td>swatch letter (a-z) - Added to the form element</td>
498                                 </tr>
499                         </table>
500
501                 </div><!--/content -->
502
503         <div class="content-secondary">
504
505                 <div data-role="collapsible" data-collapsed="true" data-theme="b" data-content-theme="d">
506
507                                 <h3>More in this section</h3>
508
509                                 <ul data-role="listview"  data-theme="c" data-dividertheme="d">
510
511                                         <li data-role="list-divider">API</li>
512                                         <li><a href="../../docs/api/globalconfig.html">Configuring defaults</a></li>
513                                         <li><a href="../../docs/api/events.html">Events</a></li>
514                                         <li><a href="../../docs/api/methods.html">Methods &amp; Utilities</a></li>
515                                         <li data-theme="a"><a href="../../docs/api/data-attributes.html">Data attribute reference</a></li>
516                                         <li><a href="../../docs/api/themes.html">Theme framework</a></li>
517                                 </ul>
518                 </div>
519         </div>
520
521 </div><!-- /content -->
522
523 <div data-role="footer" class="footer-docs" data-theme="c">
524                 <p>&copy; 2011-12 The jQuery Foundation</p>
525 </div>
526
527 </div><!-- /page -->
528
529 </body>
530 </html>