Tokentextarea: Fix issues
[platform/framework/web/web-ui-fw.git] / libs / js / jquery-mobile-1.1.0 / 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/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>Button basics</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">
26                 <div class="content-primary">
27                 
28                  <h2>Button basics</h2>         
29                 
30          <ul data-role="controlgroup" data-type="horizontal" class="localnav">
31                                 <li><a href="buttons-types.html" data-role="button" data-transition="fade" class="ui-btn-active">Basics</a></li>
32                                 <li><a href="buttons-options.html" data-role="button" data-transition="fade">Options</a></li>
33                                 <li><a href="buttons-methods.html" data-role="button" data-transition="fade">Methods</a></li>
34                                 <li><a href="buttons-events.html" data-role="button" data-transition="fade">Events</a></li>
35                         </ul>   
36                         
37                         
38    <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.</p>
39         <p>View the <a href="../api/data-attributes.html">data- attribute reference</a> to see all the possible attributes for buttons including adding <a href="buttons-icons.html">icons</a> or displaying them <a href="buttons-inline.html">inline</a> or <a href="buttons-grouped.html">grouped</a>.</p>
40         
41                 <h2>Styling links as buttons</h2>
42
43                 <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>
44
45 <code>
46 &lt;a href=&quot;index.html&quot; data-role=&quot;button&quot;&gt;Link button&lt;/a&gt;
47 </code>
48
49                 <p>Produces this <strong>link-based</strong> button:</p>
50                 <a href="index.html" data-role="button">Link button</a>
51                 
52                 <p><strong>Note:</strong> 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>
53                 
54                 <h2>Mini size</h2>
55
56                 <p>For a more compact version that is useful in toolbars and tight spaces, add the <code>data-mini="true"</code> attribute to the button to create a <a href="../forms/forms-all-mini.html">mini version</a>. </p>
57
58 <pre><code>     
59 &lt;a href=&quot;index.html&quot; data-role=&quot;button&quot; <strong>data-mini=&quot;true&quot;</strong>&gt;Link button&lt;/a&gt;
60 </code></pre>
61
62                 <p>This will produce a search input that a not as tall as the standard version and has a smaller text size.</p>
63          <a href="index.html" data-role="button" data-mini="true">Link button</a>
64                 
65                 
66                 
67                 <h2>Form buttons</h2>
68                 <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>
69
70 <code>
71 $('[type='submit']').button();
72 </code>
73
74                 <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>
75
76                 <p><strong>Button</strong> based button:</p>
77                 <button>Button element</button>
78                 
79                 <p><strong>Input type="button"</strong> based button:</p>
80                 <input type="button" value="buttonBtn" />
81                 
82                 <p><strong>Input type="submit"</strong> based button:</p>
83                 <input type="submit" value="submitBtn" />
84                 
85                 <p><strong>Input type="reset"</strong> based button:</p>
86                 <input type="reset" value="resetBtn" />
87                 
88                 <p><strong>Input type="image"</strong> based button:</p>
89                 <input type="image" value="imageBtn" />
90                 
91         </div><!--/content-primary -->          
92         
93         <div class="content-secondary">
94                 
95                 <div data-role="collapsible" data-collapsed="true" data-theme="b" data-content-theme="d">
96                         
97                                 <h3>More in this section</h3>
98                                 
99                                 <ul data-role="listview" data-theme="c" data-dividertheme="d">                          
100                                         <li data-role="list-divider">Buttons</li>
101                                         <li data-theme="a"><a href="buttons-types.html">Button basics</a></li>
102                                         <li><a href="buttons-icons.html">Button icons</a></li>
103                                         <li><a href="buttons-inline.html">Inline buttons</a></li>
104                                         <li><a href="buttons-grouped.html">Grouped buttons</a></li>
105                                         <li><a href="buttons-themes.html">Theming buttons</a></li>      
106                                 </ul>
107                 </div>
108         </div>          
109
110 </div><!-- /content -->
111
112 <div data-role="footer" class="footer-docs" data-theme="c">
113                 <p>&copy; 2011-12 The jQuery Foundation</p>
114 </div>
115         
116 </div><!-- /page -->
117
118 </body>
119 </html>