Simple Javascript Validation without Alerts

Simple Javascript Validation without Alerts
In this article we are going to see simple Javascript form validations without using alerts.

We are going to validate the form fields and display the message near the text box.

We are going to have 4 fields in the html,
Username:  if this field is left empty an error message is shown near the textbox and when some value is entered in this field the message disappears

Email: This field should have ‘@’ to confirm it as email address, if not show an error message. If value is entered error message should disappear

Password: Should be greater than 6 characters if not show error message, on correct entry error message disappears

Pattern: This field will check for Regular Expression pattern. No special characters allowed in this field.

Output:
op1

op2

 

Read More