Build jQuery UI Button - Radios in JavaScript

Description

The following code shows how to build jQuery UI Button - Radios.

Example


<!-- Revised from demo code on http://jqueryui.com/ -->
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Button - Radios</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" />
<!--from   ww  w .jav a 2 s  .c  om-->
<script>
$(function() {
$( "#radio" ).buttonset();
});
</script>
</head>
<body>

<form>
<div id="radio">
<input type="radio" id="radio1" name="radio" /><label for="radio1">Choice 1</label>
<input type="radio" id="radio2" name="radio" checked="checked" /><label for="radio2">Choice 2</label>
<input type="radio" id="radio3" name="radio" /><label for="radio3">Choice 3</label>
</div>
</form>

<div class="demo-description">
<p>A set of three radio buttons transformed into a button set.</p>
</div>
</body>
</html>

Click to view the demo

The code above generates the following result.

Build jQuery UI Button - Radios in JavaScript
Home »
  Javascript Tutorial »
    jQuery UI »
      Button
Javascript Tutorial Button
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...