Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery Mobile Form Inputs

jQuery Mobile Form Input Elements


jQuery Mobile Text Inputs

Input fields are coded with standard HTML elements, and jQuery Mobile adds styles to them to make them more attractive and easier to use on mobile devices. You can also use the new HTML5 Type:

Example

Try it »

**Tip:** Use placeholder to specify a short description of the expected value of the input field:






Textarea

For multi-line text input you can use

Try it »


Search inputs

The type="search" input was added in HTML5; it defines a text field for entering a search:

Example

Try it »


Radio Button

Use radio buttons when a user should select only one option from a limited number of choices.

To create a series of radio buttons, add inputs with type="radio" and corresponding labels. Wrap the radio buttons in

an element. You can also add a the element to define
The title of .

**Tip:** Use data-role="controlgroup" to group buttons together:

Example

Choose your gender:

Try it »


Checkbox

Use checkboxes when a user should select one or more options from a limited number of choices:

Example

Choose as many favorite colors as you'd like:

Try it »


More examples

To horizontally group radio buttons or checkboxes, use data-type="horizontal":

Example

Try it »

You can also surround them with a field container

:

Example

Please select your gender:

Try it »

If you want one of your buttons to be pre-selected, use the HTML checked attribute:

Example

Try it »

You can place the form in a popup:

Example

Show Popup Form

 

   

     

Login information

     

     

     

     

   

 

Try it »