Single radio box radio click to check click to uncheck

$("input:radio").click(function(){
var domName = $(this).attr('name');//Get the current radio control name attribute value
var checkedState = $(this).attr ('checked');//Record the current selected state
$("input:radio[name='" + domName + "']").attr('checked',false);//1.
$(this). attr('checked',true);//2.
if(checkedState == 'checked'){
$(this).attr('checked',false); //3.
}
});

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324908410&siteId=291194637