disable radio if not checked by default - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:jQuery Method Example

Description

disable radio if not checked by default

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){//from  ww  w.  j av  a  2s .  c o  m
$('input:radio').prop('disabled', function(){ return !this.checked; });
    });

      </script> 
 </head> 
 <body> 
  <input id="1-4" name="section[1]" value="3" type="radio" checked> 
  <input id="1-5" name="section[1]" value="4" type="radio">  
 </body>
</html>

Related Tutorials