This is my checkbox HTML code
class=\"che
Simply bind an onchange handler to your checkbox.
$("#termsCheckbox").change(function() { // class will be removed if checked="checked" // otherwise will be added $(this).toggleClass("terms_error", !this.checked); }).change(); // set initial state