fix arm build issue
[framework/web/web-ui-fw.git] / libs / js / jquery-mobile-1.1.0 / docs / forms / textinputs / index.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 - Text inputs</title> 
7         <link rel="stylesheet"  href="../../../css/themes/default/jquery.mobile.css" />
8         <link rel="stylesheet" href="../../_assets/css/jqm-docs.css"/>
9         <script src="../../../experiments/themeswitcher/jquery.mobile.themeswitcher.js"></script>
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>Text inputs</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                 <form action="#" method="get">
29
30                         <h2>Text inputs & Textareas</h2>
31                         
32                         <ul data-role="controlgroup" data-type="horizontal" class="localnav">
33                                 <li><a href="index.html" data-role="button" data-transition="fade" class="ui-btn-active">Basics</a></li>
34                                 <li><a href="options.html" data-role="button" data-transition="fade">Options</a></li>
35                                 <li><a href="methods.html" data-role="button" data-transition="fade">Methods</a></li>
36                                 <li><a href="events.html" data-role="button" data-transition="fade">Events</a></li>
37                         </ul>
38
39                         <p>Text inputs and textareas are coded with standard HTML elements, then enhanced by jQuery Mobile to make them more attractive and useable on a mobile device. View the <a href="../../api/data-attributes.html">data- attribute reference</a> to see all the possible attributes you can add to text inputs.</p>
40                         
41                         <h2>Text inputs</h2>
42                         <p>To collect standard alphanumeric text, use an <code>input</code> with a <code>type="text"</code> attribute. Set the <code>for</code> attribute of the <code>label</code> to match the ID of the <code>input</code> so they are semantically associated. It's possible to <a href="../docs-forms.html">accessibly hide the label</a> if it's not desired in the page layout, but we require that it is present in the markup for semantic and accessibility reasons.</p>
43
44 <pre><code>     
45     &lt;label for=&quot;basic&quot;&gt;Text Input:&lt;/label&gt;
46     &lt;input type=&quot;text&quot; name=&quot;name&quot; id=&quot;basic&quot; value=&quot;&quot;  /&gt;
47 </code></pre>           
48
49                         <p>This will produce a basic text input. The default styles set the width of the input to 100% of the parent container and stack the label on a separate line.</p>
50                         
51                  <label for="basic">Text Input:</label>
52                  <input type="text" name="name" id="basic" value="" />
53         
54                         <h2>Mini version</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 element to create a <a href="../forms-all-mini.html">mini version</a>. </p>
57
58 <pre><code>     
59 &lt;label for=&quot;basic&quot;&gt;Text Input:&lt;/label&gt;
60 &lt;input type=&quot;text&quot; name=&quot;name&quot; id=&quot;basic&quot; value=&quot;&quot; <strong>data-mini=&quot;true&quot;</strong> /&gt;
61 </code></pre>
62                         
63                         <p>This will produce an input that is not as tall as the standard version and has a smaller text size.</p>
64                  <label for="mini">Text Input:</label>
65                  <input type="text" name="name" id="mini" value="" data-mini="true" />
66
67                         <h2>Field containers</h2>
68
69                         <p>Optionally wrap the text input in a container with the <code> data-role="fieldcontain"</code> attribute to help visually group it in a longer form.</p>
70
71 <pre><code>     
72 <strong>&lt;div data-role=&quot;fieldcontain&quot;&gt;
73 </strong>    &lt;label for=&quot;name&quot;&gt;Text Input:&lt;/label&gt;
74     &lt;input type=&quot;text&quot; name=&quot;name&quot; id=&quot;name&quot; value=&quot;&quot;  /&gt;
75 <strong>&lt;/div&gt;    
76 </strong></code></pre>          
77                          
78                         <p>The text input is now displayed like this:</p>
79                 <div data-role="fieldcontain">
80                  <label for="name">Text Input:</label>
81                  <input type="text" name="name" id="name" value="" />
82                         </div>
83                                                 
84                         
85                         <h2>More text input types</h2>
86                         <p>In jQuery Mobile, you can use existing and new HTML5 input types such as <code>password</code>, <code>email</code>, <code>tel</code>, <code>number</code>, and more.  Some type values are rendered differently across browsers. For example, Chrome renders the <code>range</code> input as a slider. jQuery Mobile standardizes the appearance of <code>range</code> and <code>search</code> by dynamically changing their type to <code>text</code>. You can configure which input types are degraded to <code>text</code> with the <code>page</code> plugin's options.</p>
87                         
88                         <p>One major advantage of using these more specific input types if that on mobile devices, specialized keyboards that speed data entry are offered in place of the standard text keyboard. Try the following inputs on a mobile device to see which display custom keyboards on various platforms.</p>
89                         
90                         <div data-role="fieldcontain">
91                  <label for="password">Password:</label>
92                  <input type="password" name="password" id="password" value="" />
93                         </div>
94                         
95                         <div data-role="fieldcontain">
96                  <label for="number">Number:</label>
97                  <input type="number" name="number" id="number" value="" />
98                         </div>
99                         
100                         <div data-role="fieldcontain">
101                  <label for="number-pattern">Number + pattern:</label>
102                  <input type="number" name="number" pattern="[0-9]*" id="number-pattern" value="" placeholder="Pattern attribute [0-9]* for a numeric keypad" />
103                         </div>
104                         
105                         <div data-role="fieldcontain">
106                  <label for="email">Email:</label>
107                  <input type="email" name="email" id="email" value="" />
108                         </div>
109                         
110                         <div data-role="fieldcontain">
111                  <label for="url">Url:</label>
112                  <input type="url" name="url" id="url" value="" />
113                         </div>
114                         
115                         <div data-role="fieldcontain">
116                  <label for="tel">Tel:</label>
117                  <input type="tel" name="tel" id="tel" value="" />
118                         </div>
119                         
120                         <div data-role="fieldcontain">
121                  <label for="time">Time:</label>
122                  <input type="time" name="time" id="time" value="" />
123                         </div>
124                         
125                         <div data-role="fieldcontain">
126                  <label for="date">Date:</label>
127                  <input type="date" name="date" id="date" value="" />
128                         </div>
129                         
130                         <div data-role="fieldcontain">
131                  <label for="month">Month:</label>
132                  <input type="month" name="month" id="month" value="" />
133                         </div>
134                         
135                         <div data-role="fieldcontain">
136                  <label for="week">Week:</label>
137                  <input type="week" name="week" id="week" value="" />
138                         </div>
139                         
140                         <div data-role="fieldcontain">
141                  <label for="datetime">Datetime:</label>
142                  <input type="datetime" name="datetime" id="datetime" value="" />
143                         </div>
144                         
145                         <div data-role="fieldcontain">
146                  <label for="datetime-l">Datetime local:</label>
147                  <input type="datetime-local" name="datetime-l" id="datetime-l" value="" />
148                         </div>
149                         
150                         <div data-role="fieldcontain">
151                  <label for="color">Color:</label>
152                  <input type="color" name="color" id="color" value="" />
153                         </div>
154                         
155                         
156                         
157                         <h2>Textareas</h2>
158                         <p>For multi-line text inputs, use a <code>textarea</code> element. The framework will auto-grow the height of the textarea to avoid the need for an internal scrollbar. </p>
159                         <p>Set the <code>for</code> attribute of the <code>label</code> to match the ID of the <code>textarea</code> so they are semantically associated, and wrap them in a <code>div</code> with the <code> data-role="fieldcontain"</code> attribute to group them.</p>
160
161 <pre><code>     
162 <strong>&lt;label for=&quot;textarea-a&quot;&gt;Textarea:&lt;/label&gt;
163 &lt;textarea name=&quot;textarea&quot; id=&quot;textarea-a&quot;&gt;</strong>
164 I&#x27;m a basic textarea. If this is pre-populated with content, the height will be automatically adjusted to fit without needing to scroll. That is a pretty handy usability feature.
165 <strong>&lt;/textarea&gt;</strong>
166 </code></pre>   
167
168                         <p>This will produce a basic textarea with the width set to 100% of the parent container and the label stacked on a separate line. The textarea will grow to fit new lines as you type:</p>
169                         <label for="textarea-a">Textarea:</label>
170                         <textarea name="textarea" id="textarea-a">
171 I'm a basic textarea. If this is pre-populated with content, the height will be automatically adjusted to fit without needing to scroll. That is a pretty handy usability feature.
172                         </textarea>
173
174 <pre><code>     
175 <strong>&lt;div data-role=&quot;fieldcontain&quot;&gt;
176 </strong>&lt;label for=&quot;textarea&quot;&gt;Textarea:&lt;/label&gt;
177         &lt;textarea name=&quot;textarea&quot; id=&quot;textarea&quot;&gt;&lt;/textarea&gt;
178 <strong>&lt;/div&gt;</strong>
179 </code></pre>   
180                          
181                         <p>The textarea is displayed like this and will grow to fit new lines as you type:</p>
182                         <div data-role="fieldcontain">
183                         <label for="textarea">Textarea:</label>
184                         <textarea name="textarea" id="textarea"></textarea>
185                         </div>
186                         
187                         
188                         <h2>Calling the textinput plugin</h2>
189
190                         <p>This plugin will auto initialize on any page that contains a textarea or any of the text input types listed above without any need for a <code>data-role</code> attribute in the markup. However, if needed, you can directly call the <code>textinput</code> plugin on any selector, just like any jQuery plugin:</p>
191                         <pre><code>
192 $('input').textinput();                 
193                         </code></pre>
194                         
195                         
196                         <h2>Degraded input types</h2>
197                         <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>
198                         <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>
199                 
200                         <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>     
201                 
202
203         </form>
204         
205         </div><!--/content-primary -->          
206         
207         <div class="content-secondary">
208                 
209                 <div data-role="collapsible" data-collapsed="true" data-theme="b" data-content-theme="d">
210                         
211                                 <h3>More in this section</h3>
212                                 
213                                 <ul data-role="listview" data-theme="c" data-dividertheme="d">
214                                 
215                                         <li data-role="list-divider">Form elements</li>
216                                         <li><a href="../docs-forms.html">Form basics</a></li>
217                                         <li><a href="../forms-all.html">Form element gallery</a></li>
218                                         <li><a href="../forms-all-mini.html">Mini form element gallery</a></li>
219                                         <li data-theme="a"><a href="index.html">Text inputs</a></li>
220                                         <li><a href="../search/">Search input</a></li>
221                                         <li><a href="../slider/">Slider</a></li>
222                                         <li><a href="../switch/">Flip toggle switch</a></li>
223                                         <li><a href="../radiobuttons/">Radio buttons</a></li>
224                                         <li><a href="../checkboxes/">Checkboxes</a></li>
225                                         <li><a href="../selects/">Select menus</a></li>
226                                         <li><a href="../forms-themes.html">Theming forms</a></li>
227                                         <li><a href="../forms-all-native.html">Native form elements</a></li>
228                                         <li><a href="../forms-sample.html">Submitting forms</a></li>
229                                         
230         
231                                 </ul>
232                 </div>
233         </div>          
234
235 </div><!-- /content -->
236
237 <div data-role="footer" class="footer-docs" data-theme="c">
238                 <p>&copy; 2011-12 The jQuery Foundation</p>
239 </div>
240         
241 </div><!-- /page -->
242
243 </body>
244 </html>