The title seems easy, but I need help.
I have a form with a field input \"email\" of which value is null until the user fills it up. Okay, on click of the submit button,
Try this email.value = 'Insert a correct email';
instead of email.setAttribute('value','Insert a correct email');
It's good that you were trying to use setAttribute
at all because it's an important method, but the problem is that you don't want to modify the value
attribute in this case, which is a part of the DOM, but you want to modify the <input>
element's value
property.
email.value = 'Insert a correct email';
http://jsfiddle.net/XJZwm/