68b0de97832aeeab52509b8a5b4d62182b67089d
[platform/framework/web/web-ui-fw.git] / libs / js / jquery-mobile-1.0.1pre / docs / forms / search / 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 - Search input</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>Search input</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                 <form action="#" method="get">
27
28                         <h2>Search input</h2>
29                         
30                         <ul data-role="controlgroup" data-type="horizontal" class="localnav">
31                                 <li><a href="index.html" data-role="button" data-transition="fade" class="ui-btn-active">Basics</a></li>
32                                 <li><a href="options.html" data-role="button" data-transition="fade">Options</a></li>
33                                 <li><a href="methods.html" data-role="button" data-transition="fade">Methods</a></li>
34                                 <li><a href="events.html" data-role="button" data-transition="fade">Events</a></li>
35                         </ul>
36
37                         <p>Search inputs are a new HTML type that is styled with pill-shaped corners and adds a "x" icon to clear the field once you start typing. Start with an <code>input</code> with a <code>type="search"</code> attribute in your markup. View the <a href="../../api/data-attributes.html">data- attribute reference</a> to see all the possible attributes you can add to search inputs.</p>
38                         
39                         <p>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>
40                                 
41                                 <pre><code>     
42 &lt;label for=&quot;search-basic&quot;&gt;Search Input:&lt;/label&gt;
43 &lt;input type=&quot;search&quot; name=&quot;search&quot; id=&quot;searc-basic&quot; value=&quot;&quot; /&gt;
44                                 </code></pre>   
45
46                                 <p>This will produce a basic search input. The default styles set the width of the input to 100% of the parent container and stacks the label on a separate line.</p>
47                          <label for="search-basic">Search Input:</label>
48                                  <input type="search" name="search" id="search-basic" value="" />
49                         
50                                 
51                                  <p>Optionally wrap the search input in a container with the <code>data-role="fieldcontain"</code> attribute to help visually group it in a longer form.</p>
52
53 <pre><code>     
54 <strong>&lt;div data-role=&quot;fieldcontain&quot;&gt;
55 </strong>    &lt;label for=&quot;search&quot;&gt;Search Input:&lt;/label&gt;
56     &lt;input type=&quot;search&quot; name=&quot;password&quot; id=&quot;search&quot; value=&quot;&quot; /&gt;
57 <strong>&lt;/div&gt;
58 </strong></code></pre>  
59                          
60                         <p>The search input is now displayed like this:</p>
61                         <div data-role="fieldcontain">
62                  <label for="search">Search Input:</label>
63                  <input type="search" name="search2" id="search" value="" />
64                         </div>
65
66                         <p>Themed variation:</p>
67                         <div data-role="fieldcontain">
68                  <label for="searchA">Search Input:</label>
69                  <input type="search" name="search3" id="searchA" value="" data-theme="a" />
70                         </div>
71
72                 
73                         
74                         <h2>Calling the textinput plugin</h2>
75
76 <p>This plugin will auto initialize on any page that contains a text input with the <code>type="search"</code> attribute, no need for a <code>data-role</code> attribute in the markup. However, if needed you can directly call the <code>textinput</code> plugin on a selector, just like any jQuery plugin:</p>
77 <pre><code>
78 $('.mySearchInput').textinput();                        
79 </code></pre>
80                         
81
82         </form>
83         
84         </div><!--/content-primary -->          
85         
86         <div class="content-secondary">
87                 
88                 <div data-role="collapsible" data-collapsed="true" data-theme="b" data-content-theme="d">
89                         
90                                 <h3>More in this section</h3>
91                                 
92                                 <ul data-role="listview" data-theme="c" data-dividertheme="d">
93                                 
94                                         <li data-role="list-divider">Form elements</li>
95                                         <li><a href="../docs-forms.html">Form basics</a></li>
96                                         <li><a href="../forms-all.html">Form element gallery</a></li>
97                                         <li><a href="../textinputs/index.html">Text inputs</a></li>
98                                         <li data-theme="a"><a href="index.html">Search input</a></li>
99                                         <li><a href="../slider/">Slider</a></li>
100                                         <li><a href="../switch/">Flip toggle switch</a></li>
101                                         <li><a href="../radiobuttons/">Radio buttons</a></li>
102                                         <li><a href="../checkboxes/">Checkboxes</a></li>
103                                         <li><a href="../selects/">Select menus</a></li>
104                                         <li><a href="../forms-themes.html">Theming forms</a></li>
105                                         <li><a href="../forms-all-native.html">Native form elements</a></li>
106                                         <li><a href="../forms-sample.html">Submitting forms</a></li>
107                                         
108         
109                                 </ul>
110                 </div>
111         </div>          
112
113 </div><!-- /content -->
114
115 <div data-role="footer" class="footer-docs" data-theme="c">
116                 <p>&copy; 2011 The jQuery Project</p>
117 </div>
118         
119 </div><!-- /page -->
120
121 </body>
122 </html>