I have the jQuery function below that adds some classes to elements when a checkbox is checked which is all good.
But if the checkbox is then unchecked, I want to then remove these same classes from the elements.
I'm guessing it would be with .removeClass but I can't figure out where to add it.
Thanks
function countDouble() {
var d = $("input.double:checked").length;
var s = $("input.single:checked").length;
if (d === 2) {
$(".twoday input:disabled").addClass("disabled");
$(".twoday input:disabled + label").addClass("disabled");
};
if (s === 1) {
$(".oneday input:disabled").addClass("disabled");
$(".oneday input:disabled + label").addClass("disabled");
};
};
jQuery(document).ready(function(){
countDouble();
$(":checkbox").click(countDouble);
});