jquery : detect checkbox checed state

علی ذوالفقار
1402/04/17 14:44:33 (306)
$('#myCheckBox').on('change', function() {
    var val = this.checked ? this.value : '';
    $('#show').html(val);
});

and 

if($('#myCheckBox').prop('checked') === true){
    
}

also you can set the check box like this : 

$('#myCheckBox').prop('checked', true);
$('#myCheckBox').prop('checked', false);
Back