I would like to create a form, in this form I have to validate if the value is long enough.... More than 1 character.
My actual code looks like that:
function validateForm(){
alert("Form ok");
if(document.getElementsByName("firstname").value.length >1){
alert("if");
}
else{
document.getElementById("nameValidation").innerHTML= "* You must enter a first name";
alert("else");
}
I am struggling to understand why it doesn't work....
Many thanks.