Javascript code for validating email address

Posted by / 08-Jul-2016 14:26

Form validation is the process of checking that a form has been filled in correctly before it is processed.

Incase you didn't provide information in the format specified by the form field or leave it empty, the message will appear and form cannot be submitted until you get it right.

In case you are using Node.js, you can use the same regular expression function below to validate emails both on the clientside and the serverside.

Function for validating email address The above regular expression is a generic email validator, it may fail for some very rare but valid emails.

There are two main methods for validating forms: (usually done using Java Script).

Server-side validation is more secure but often more tricky to code, whereas client-side (Java Script) validation is easier to do and quicker too (the browser doesn't have to connect to the server to validate the form, so the user finds out instantly if they've missed out that required field! In this tutorial we'll build a simple form with client-side Java Script validation.

javascript code for validating email address-1javascript code for validating email address-84javascript code for validating email address-3