A binary "flip" switch is a common UI element on mobile devices that is used for any binary on/off or true/false type of data input. You can either drag the flip handle like a slider or tap on each half of the switch.
To create a flip toggle, To add a slider widget to your page, start with an select with two options. The first option will be styled as the "on" state switch and the second will be styled as the "off" state so write your options in the correct order. Set the for attribute of the label to match the ID of the input so they are semantically associated and wrap them in a div with the data-role="fieldcontain" attribute to group them.
<label for="slider">Select slider:</label>
<select name="slider" id="slider" data-role="slider">
The flip toggle switch is displayed like this:
var myswitch = $("select#bar");
myswitch.selectedIndex = 1;
© 2011 The jQuery Project