Menu
I am new to JavaScript. I have a form element that accepts a name. If the user leaves the name field, it should give an error in the div under the element:
[code=html]<p><label>Name: <input name = “name” id = “name” type = “text” size = “25” onblur = ‘isEmpty(this.id)’ /></label></p>
<div id = “nameErrDisplay” class = ‘validator’> </div>
I’m sure there are errors in both my HTML and my function:
[CODE]function isEmpty(id) {
if(document.getElementById(id).value == “”) {
document.getElementById(“nameErrDisplay”) = “Please enter something here.”;
}
}
Thanks in advance!