Replace addClass
with toggleClass
. Below is a custom example to show you how this may work in practice.
$(document).ready(function() {
$("#check").change(function() {
$("#header.alt").toggleClass("blue");
});
});
And JSFiddle: http://jsfiddle.net/FSNL3/1/
If you populate the form with data, remember to automaticaly apply class on load, if the checkbox is checked. Then, the snippted above will do the work for you.