Could someone help me out with this simple function:
I have 2 checkboxes, one called "other" and the other "info"
When user clicks on "other" "info" needs to be disabled and some content hidden. When "info" is checked, "other" needs to be enabled and additional content shown.
Here is the code:
$("#mydiv").on("click", ".docheck :checkbox", function () {
if ($(this).is(':checked')) {
if ($(this).prop('name') == "other") {
$(".header").toggle()
} else {
$(".header").toggle()
$('.docheck').find('input[type=checkbox]').prop('checked', false);
$(this).prop('checked', true)
}
}
});
So far it works partially. After few clicks, both checkboxes end up being checked.