javascript - Proper place for error message/hint in a html form -


I have a simple standard form and are planning to use javascript

Document.getElementById ("Idname"). InnerHTML = "signal / error message";

To change / display my error message on the form.

Error message on the form?

Inside the label? Next to the label?

Do I put it in a div or span?

(I would like the error message to display on the right side of the input field.)

Here's my form:

  & lt ; Form id = "registerForm" method = "post" action = "register_post.php" & gt; & Lt; P class = "form-registerUserName" & gt; & Lt; Label = "registerUserName" & gt; Username & lt; / Label & gt; & Lt; span class = "required" & gt; * & Lt; / Span & gt; & Lt; Input id = "registerUserName" name = "registerUserName" type = "text" size = "24" maxlength = "24" value = "& lt ;? php echo $ _SESSION ['registerUserName'];? & Gt; Onkeyup = "validateName ()" onblur = "validateName ()" & gt; & Lt; / P & gt; & Lt; / Form & gt;   

Thanks in advance.

Usually this is good if you use a div as a cover and in a label Take the error message, and place it next to the input box.

Say: Username * "onkeyup =" validateName () "onblur =" validateName () "& gt;

CSS < Previous> Input {Display: Inline-Block;} label .error_msg {Display: None; color: red;}

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -