I have written a function for a hdcheck checkbox.
$('#hdcheck').change(function () {
if($(this).is(':checked')) {
alert("It is Checked");
}
else {
alert("It is Unchecked");
}
});
It works find when I check or uncheck the checkbox but I have made a function that problematically make this checkbox checked or unchecked.
Here is the function on checkbox chk_1
:
$('#chk_1').change(function () {
if($(this).is(':checked')) {
$('#hdcheck').prop("checked", true);
}
else {
$('#hdcheck').prop("checked", false);
}
});
This function works fine on making the first checkbox (hdcheck
) checked or unchecked but it does not pop ups the alert message. Mean the function $('#hdcheck').change(function()
does not work.