I'm trying to make a radio button uncheck when clicked again and the below code only works for the first uncheck.
lastChecked = null; inside the if statement gives warning that "value assigned is never used"
and I suspect that this is the cause of issue which I can't figure out.
What can be done to arrange this variable in correct scope?
var lastChecked = null;
$j('input[name=radio-group]:radio').click(function(){
if (lastChecked == this) {
this.checked = false;
lastChecked = null;
}
lastChecked = this;
});
lastChecked = this;