A form is an HTML element that allows users to send data to the server.
Mobile forms are the same thing as forms but they fit in well to a mobile device display (aspect ratio).
jQuery mobile forms are responsive forms that are styled and made dynamic with jQuery libraries.
The jQuery mobile form has the below controls:
<form>
with jQueryA label
is required for each form
element. Set the label’s for
attribute to match the element’s name
.
Let’s look at an example:
Lines 5 to 7: We add jQuery’s library to enable the styling.
Line 14: Our form has an attribute data-role
with the value of controlgroup
. It helps jQuery to locate the form
where the element is styled.
Note: All the check boxes have a
label
element and thefor
attribute value is the same as the name of theinput
.
This allows jQuery to uniquely identify each field.