Toggle div based on checkbox value
.toggle()
takes a boolean as well, like this:
$(function () {
$('.always').change(function () {
$('#dates').toggle(!this.checked);
}).change(); //ensure visible state matches initially
});
You can test it out here. I assume in the above you want the #dates
hidden if .always
is checked, that's what it'll do.
$('.always').change(function() {
$('#dates').toggle(!this.checked);
});