Validating email address in javascript

In the above form, we are calling validate() to validate data when onsubmit event is occurring.

validating email address in javascript-22

This method accepts regex expressions as arguments to check the string and returns the position of the specified value in the string or a -1 if no match was found.

If the search() method returns a -1, then an alert would tell the user that an invalid email address has been entered and returns a false value.

Nothing exciting here except in line 6 where the on Click event is triggered when the user clicks on the button.

This event will launch the verify Email() Java Script function which will check the user input of the email address.

Lines 7-10 checks to see if the user has entered the same string in both email fields.

This is done by a simple equality check on the string values.

An alert tells the user that he or she has done a good job and the function returns a true value so that you can continue with the form submission.

Ideally, you would have this function run during the on Submit attribute for the form tag.

The email may request that you reply by sending personal or sensitive information and may ask for money.

Checking these email addresses through combination of our email lookup and email tracking tool can help protect your security and prevent many citizens and consumers from falling pretty to scams.

From other side verifying email sender with our email tracking tool is important and can help you detect spam, fraudulent activity and identify spoof emails.

Comments are closed.