please check this code ,use :checked
attribute and is condition
if ($('#SaveCheckbox').is(':checked')) {
console.log('Checked');
} else {
console.log('Unchecked');
}
Question
Intending to check weather the checkbox is checked or not . In both the cases , if the checkbox is checked or unchecked , i am getting the message checked . Is it the right way to handle this checking or there is some other way.
if ($('#SaveCheckbox').attr('checked') != true)
{
console.log('Checked');
}
else
{
console.log('Unchecked');
}
Solution
please check this code ,use :checked
attribute and is condition
if ($('#SaveCheckbox').is(':checked')) {
console.log('Checked');
} else {
console.log('Unchecked');
}