Book Image

jQuery Mobile First Look

Book Image

jQuery Mobile First Look

Overview of this book

Table of Contents (17 chapters)
jQuery Mobile First Look
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Flip switches, radio buttons, and checkboxes


Whenever we need the user to choose between a restricted set of answers or options, it's usually a good idea not to make them write into a text field: people are funny beings and often "mistakenly" enter some completely unrelated (though sometimes hilarious) text into a field we might value as important.

For this reason, we might force the user to answer either "Yes" or "No" to a yes/no question, or choose one (or more) option(s) out of a number of possibilities.

Flip toggle switches

Binary flip toggle switches are UI elements used for any binary (yes/no, on/off, left/right, and so on) type of data input.

Actually, flip toggles are a particular type of select menu: the first option is styled as the "off" state of the switch, whereas the second option corresponds to the "on" state of the switch.

It is not possible to add a third option, as jQuery Mobile doesn't know how to handle it and the whole behavior of the flip toggle would be compromised.

To create...