i want checkbox. if user clicks on checkbox, should change state (checked -> unchecked , vv. ).
my code:
$('#checkboxstandard').change(function() { clickedformboxen('standard'); }); function clickedformboxen(active){ if(active == 'standard'){ if( $('#checkboxstandard').is(":checked")){ $('#checkboxstandard').prop("checked", false); }else{ $('#checkboxstandard').prop("checked", true); } console.log('ac: '+$('#checkboxstandard').is(':checked')); }
unfortunately, checkbox not unchecked again. fist time, checkbox getting checked, if click on again, nothing happens, it's still checked.
i wish use code can change state of checkbox function call , not user interaction.
please me , sorry english^^
try
$('#checkboxstandard').removeattr("checked");
Comments
Post a Comment