Home / file parsed but not updating / Validating email in javascript

Validating email in javascript

Now we will see how we can validate our entered form data before submitting it to the web server.

The following example shows how to validate an entered email address.

In forms when using email ID fields it is a good idea to use client side validation along with your programming language validation.

The following example shows how you can validate an email address for a form.

Unfortunately, it's not possible to send an email directly from the browser without outside help.I have a requirement to validate an email address entered when a user comes out from the textbox. I have googled for this but I got form validation JScript; I don't want form validation. I have written below JScript but "if email invalid it's not returning the same page". This was really a lengthy process which used to put a lot of burden on the server.Java Script provides a way to validate form's data on the client's computer before sending it to the web server. First let us see how to do a basic form validation.In this page we have discussed how to validate an email using Java Script : An email is a string (a subset of ASCII characters) separated into two parts by @ symbol. ~ characters are legal in the local part of an e-mail address but in the above regular expression those characters are filtered out. It begins with at least one or more word characters including the underscore, equivalent to [A-Za-z0-9_]. a "personal_info" and a domain, that is [email protected] The length of the personal_info part may be up to 64 characters long and domain name may be up to 253 characters. You can modify or rewrite the said regular expression. Any other kind of regex means you risk turning down completely valid e-mail addresses, other than that I agree with the answer provided by @Ben. You would then back that up with verification by sending an e-mail to that address.Form validation normally used to occur at the server, after the client had entered all the necessary data and then pressed the Submit button.If the data entered by a client was incorrect or was simply missing, the server would have to send all the data back to the client and request that the form be resubmitted with correct information.


  1. Here is a code snippet for basic JavaScript to validate email address using a regular expression.

  2. Validate email addresses in an elegant manner without turning to JavaScript, PHP, Perl or another scripting.

Leave a Reply

Your email address will not be published. Required fields are marked *