Build jQuery UI Button - Checkboxes in JavaScript
Description
The following code shows how to build jQuery UI Button - Checkboxes.
Example
<!-- Revised from demo code on http://jqueryui.com/ -->
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Button - Checkboxes</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
<link type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css" rel="stylesheet" />
<!-- www .ja v a 2 s . c o m-->
<script>
$(function() {
$( "#check" ).button();
$( "#format" ).buttonset();
});
</script>
<style>
#format { margin-top: 2em; }
</style>
</head>
<body>
<input type="checkbox" id="check" /><label for="check">Toggle</label>
<div id="format">
<input type="checkbox" id="check1" /><label for="check1">B</label>
<input type="checkbox" id="check2" /><label for="check2">I</label>
<input type="checkbox" id="check3" /><label for="check3">U</label>
</div>
<div class="demo-description">
<p>A checkbox is styled as a toggle button with the button widget. The label element associated with the checkbox is used for the button text.</p>
<p>This demo also demonstrates three checkboxes styled as a button set by calling <code>.buttonset()</code> on a common container.</p>
</div>
</body>
</html>
The code above generates the following result.
Javascript Tutorial Button
Build jQuery UI Button - Icons in JavaScrip...
Build jQuery UI Button - Radios in JavaScri...
Build jQuery UI Button - Split button in Ja...
Build jQuery UI Button - Toolbar in JavaScr...
Build jQuery UI Button - Checkboxes in Java...
Build jQuery UI Button - Default functional...Build jQuery UI Button - Icons in JavaScrip...
Build jQuery UI Button - Radios in JavaScri...
Build jQuery UI Button - Split button in Ja...
Build jQuery UI Button - Toolbar in JavaScr...