Disable radio buttons via Javascript

Description

The following code shows how to disable radio buttons via Javascript.

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/latest/jquery.mobile.min.js"></script>
<link rel="stylesheet" type="text/css"
  href="http://code.jquery.com/mobile/latest/jquery.mobile.min.css">
<script type='text/javascript'>//<![CDATA[ 
$(window).load(function(){<!--from w w w. j  a v a  2 s  .  c om-->
   $("#options input[type='radio']").checkboxradio('disable');
});//]]>  
</script>
</head>
<body>
  <fieldset data-role="controlgroup" id="options">
    <input type="radio" name="radio-choice-1" id="optiona" value="a"
      checked="checked"> <label for="optiona" id="labela">Ondo</label>
    <input type="radio" name="radio-choice-1" id="optionb" value="b">
    <label for="optionb">Lagos</label> 
    <input type="radio" name="radio-choice-1" id="optionc" value="c"> 
    <label for="optionc">Abuja</label> 
    <input type="radio" name="radio-choice-1" id="optiond" value="d"> 
    <label for="optiond">Kogi</label> 
    <input type="radio" name="radio-choice-1" id="optione" value="e"> 
    <label for="optione">Niger</label>
  </fieldset>
</body>
</html>

Click to view the demo





















Home »
  jQuery Mobile »
    Example »




Button
Button Event
Button Icon
Button Text
Checkbox
Collapsible
Date
Dialog
Event
Footer
Form
Header
Icon
Input
Layout
Listview
Listview Divider
Listview Item
Loader
mobile_settings
Navbar
Page
Page Event
Popup
Radio
Select
Slider
Switch
Textarea
Theme