Quantcast
Channel: SharePoint 2010 - General Discussions and Questions forum
Viewing all articles
Browse latest Browse all 17574

Radio button check uncheck condition

$
0
0

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


Viewing all articles
Browse latest Browse all 17574

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>