This is my checkbox HTML code
class=\"che
Live Demo (Click the "Terms Div" text to test)
I didnt see the question tagged with jQuery, but I noticed a jQery selector was used.. so just to be safe I did it with pure JS anyway.
Pure JS
var terms = document.getElementById("termsCheckbox"),
terms_div = document.getElementById("terms_div");
function validateTerms(){
if(terms.checked == false){
if(terms_div.className.indexOf("terms_error")<0){
terms_div.className += " terms_error";
}
return false;
}else{
terms_div.className = terms_div.className.replace(/\bterms_error\b/,'');
return true;
}
}