Sorry. Let me rephrase:
I want js to change to class of a input field if it is left empty; Here is my code to detect a empty field:
function validateForm()
{
var ctrl = document.forms["form1"]["username"];
var x=ctrl.value;
if (x==null || x=="") {
////////////CHANGE INPUT CLASS/////////////
}
else {
document.getElementById('username').style.backgroundColor="#FFFFFF";
}
}
i would have to css classes:
.inputfield {
background-color:white;
}
.inputfieldempty {
background-color:red;
}