I am trying to build a simple login form with HTML and CSS and I am using Javascript for empty field validations.
Here is my jsfiddle
I am trying to validate for empty text on the textboxes and display the error message below each textbox using the css and HTML.
CSS
.validation
{
color: red;
margin-bottom: 20px;
}
Javascript
$("#txtUsername").parent().after("<div class='validation' style='color:red;margin-bottom: 20px;'>Please enter username</div>");
I am trying to follow this question and replicate same but somehow it it not working.
Any help?
Thanks in advance.
