Tizen 2.1 base
[platform/framework/web/web-ui-fw.git] / libs / js / jquery-mobile-1.0.1pre / docs / buttons / buttons-types.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 - Button types</title> 
7         <link rel="stylesheet"  href="../../css/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>Button basics</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                  <h2>Button basics</h2>         
27                 
28          <ul data-role="controlgroup" data-type="horizontal" class="localnav">
29                                 <li><a href="buttons-types.html" data-role="button" data-transition="fade" class="ui-btn-active">Basics</a></li>
30                                 <li><a href="buttons-options.html" data-role="button" data-transition="fade">Options</a></li>
31                                 <li><a href="buttons-methods.html" data-role="button" data-transition="fade">Methods</a></li>
32                                 <li><a href="buttons-events.html" data-role="button" data-transition="fade">Events</a></li>
33                         </ul>   
34                         
35                         
36    <p>Buttons are coded with standard HTML anchor and input elements, then enhanced by jQuery Mobile to make them more attractive and useable on a mobile device.  Use anchor links (<code>a</code> elements) to mark up navigation buttons, and <code>input</code> or <code>button</code> elements for form submission. View the <a href="../api/data-attributes.html">data- attribute reference</a> to see all the possible attributes you can add to buttons.</p>
37         
38                 <h2>Styling links as buttons</h2>
39
40                 <p>In the main content block of a page, you can style any anchor link as a button by adding the <code>data-role="button"</code> attribute. The framework will enhance the link with markup and classes to style the link as a button. For example, this markup: </p>
41
42 <code>
43 &lt;a href=&quot;index.html&quot; data-role=&quot;button&quot;&gt;Link button&lt;/a&gt;
44 </code>
45
46                 <p>Produces this <strong>link-based</strong> button:</p>
47                 <a href="index.html" data-role="button">Link button</a>
48                 
49                 <p>Links styled like buttons have all the same visual options as true form-based buttons below, but there are a few important differences. Link-based buttons aren't part of the <code>button</code> plugin and only just use the underlying <code>buttonMarkup</code> plugin to generate the button styles so the form button methods (enable, disable, refresh) aren't supported. If you need to disable a link-based button (or any element), it's possible to apply the disabled class ui-disabled yourself with JavaScript to achieve the same effect.</p>
50                 
51                 <h2>Form buttons</h2>
52                 <p>For ease of styling, the framework automatically converts any <code>button</code> or <code>input</code> element with a <code>type</code> of <code>submit</code>, <code>reset</code>, <code>button</code>, or <code>image</code> into a custom styled button &mdash; there is no need to add the <code> data-role="button"</code> attribute. However, if needed, you can directly call the button plugin on any selector, just like any jQuery plugin:</p>
53
54 <code>
55 $('[type='submit']').button();
56 </code>
57
58                 <p>To preserve events bound to the original <code>button</code> or <code>input</code>, the framework hides the original element by making it transparent and positioning it over the new button markup.  When a user clicks on the the custom-styled button, they're actually clicking on the original element. To prevent a form button from being converted into an enhanced button, add the <code>data-role="none"</code> attribute and hte native control will be rendered.</p>
59
60                 <p><strong>Button</strong> based button:</p>
61                 <button>Button element</button>
62                 
63                 <p><strong>Input type="button"</strong> based button:</p>
64                 <input type="button" value="buttonBtn" />
65                 
66                 <p><strong>Input type="submit"</strong> based button:</p>
67                 <input type="submit" value="submitBtn" />
68                 
69                 <p><strong>Input type="reset"</strong> based button:</p>
70                 <input type="reset" value="resetBtn" />
71                 
72                 <p><strong>Input type="image"</strong> based button:</p>
73                 <input type="image" value="imageBtn" />
74                 
75         </div><!--/content-primary -->          
76         
77         <div class="content-secondary">
78                 
79                 <div data-role="collapsible" data-collapsed="true" data-theme="b" data-content-theme="d">
80                         
81                                 <h3>More in this section</h3>
82                                 
83                                 <ul data-role="listview" data-theme="c" data-dividertheme="d">                          
84                                         <li data-role="list-divider">Buttons</li>
85                                         <li data-theme="a"><a href="buttons-types.html">Button basics</a></li>
86                                         <li><a href="buttons-icons.html">Button icons</a></li>
87                                         <li><a href="buttons-inline.html">Inline buttons</a></li>
88                                         <li><a href="buttons-grouped.html">Grouped buttons</a></li>
89                                         <li><a href="buttons-themes.html">Theming buttons</a></li>      
90                                 </ul>
91                 </div>
92         </div>          
93
94 </div><!-- /content -->
95
96 <div data-role="footer" class="footer-docs" data-theme="c">
97                 <p>&copy; 2011 The jQuery Project</p>
98 </div>
99         
100 </div><!-- /page -->
101
102 </body>
103 </html>