jscript - Uncheck a group of radio buttons with Javascript -


i have 2 groups of radio buttons. when button in on group clicked button in other group should unchecked, , vice versa.

the smartest way thought onclick. can't head around it. suggestions?

[radio button 1 name="a"] [radio button 2 name="a"] [radio button 3 name="a"]  [radio button 1 name="b"] [radio button 2 name="b"] [radio button 3 name="b"] 

thanks ray

try this:-

function disableradiobtnset(){   if ($('[name="a"]').is(':checked')){     $('input[name="b"]').attr("disabled",true);   }else{     $('input[name="a"]').attr("disabled",true);   } }  $("input[name='a']").change(function(){    disableradiobtnset(); }); $("input[name='b']").change(function(){    disableradiobtnset(); }); 

demo jsfiddle


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -