Create toggle button from checkbox
Description
The following code shows how to create toggle button from checkbox.
Example
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
src='http://code.jquery.com/jquery-1.6.js'></script>
<script type='text/javascript'
src="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.js"></script>
<link rel="stylesheet" type="text/css"
href="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.css">
<script type='text/javascript'>
$(window).load(function(){<!-- w w w .j a va 2 s . c o m-->
$("#loc").click(function(){
alert('locate clicked!');
});
});
</script>
</head>
<body>
<div data-role="page">
<div data-role="header">
<h1>Title</h1>
</div>
<!-- /header -->
<div data-role="content">
<fieldset data-role="controlgroup" data-type="horizontal"
id="locate-me">
<input type="checkbox" name="loc" id="loc" />
<label for="loc">Locate me</label>
</fieldset>
</div>
</div>
</body>
</html>