I have a div with a custom checkbox image. It is in a form. When clicked I alter the image to a "clicked image". I also adjust the value of a checkbox input which will get submitted to the form. The problem is even though the value of the "real" checkbox appears checked, it is always submitted as not checked.
if (fakeCheck.hasClass('btn-palette-checkbox')) {
fakeCheck.removeClass('btn-palette-checkbox');
fakeCheck.addClass('btn-palette-checkbox-unchecked');
$("#realCheck").attr("checked", false);
}
else {
fakeCheck.addClass('btn-palette-checkbox');
fakeCheck.removeClass('btn-palette-checkbox-unchecked');
$("#realCheck").attr("checked", true);
}
Edit: FYI the real checkbox is hidden