Hi ,
I am trying to write a code where, when a user select the radio button, a disabled button control is enabled. But when the user clicks other than the radio button (ie, anywhere else in the screen) the button should be disabled.Following is the code.
$(document).ready(function() { $("input:radio").removeAttr('checked'); $("input[type='radio']").click(function(){ var cur = document.activeElement; $("input[type='radio']:checked").each(function () { if (this == cur) checkTask(); }) }) }); function checkRadio(){ var checkstatus = $('input:radio:checked').val(); if(checkstatus) { $("input[name='btnText']").attr("disabled",false); } else { $("input[name='btnText']").attr("disabled",true); } }
The above code works fine when the radio button is checked. But clicking anywhere else in the screen doesnt make the button disabled.
P.S:The disabled property of button is disabled.
Please help.
Many thanks