I am trying to hide/show elements based on a checkbox change event. The event does get triggered, but the hide/show isn't working.
This is my code:
$("#inlineCheckbox3").change(function() {
$checked = $(this).is(":checked");
console.log($checked); //logs true or false properly
if (!$checked) {
$("#myDiv").hide(); //this doesnt work at all.
alert('test'); //alert is working
}
});
If I put something like:
if ($("#inlineCheckbox3").is(":checked")) {
$("#myDiv").hide();
}
it does work on my console.
Solution:
There was a second .click() handler in my JavaScript that caused the div to be hidden reappear right away. This way it seemed like it didnt get hidden.
#myDivdoesn't get hidden?[<>]toolbar button) right here on site.