This is my checkbox HTML code
class=\"che
You need to access the className
variable (pure JS) the following assumes your div
has an ID of terms_div
, that terms_error
is the only class you might want on the div
, and that you setup your checkbox with onClick="validateTerms();"
function validateTerms(){
var c=document.getElementById('termsCheckbox');
var d=document.getElementById('terms_div');
if (c.checked) {
d.className='';
return true;
} else {
d.className='terms_error';
return false;
}
}