Simple email validation in JavaScript | Example code

The Simplest email validation in JavaScript can done by using Regular Expression.

Simplest email validation Example in JavaScript

To get a valid email id we use a regular expression. Here is complete HTML code:-

Output:

Simplest email validation Example in JavaScript

Q: Is it possible email id validation in JavaScript without regular expression?

Answer: Let’s try it without regex, first rules you stated as well as not allowing @ to start the address and not allowing . to end the address. It does not account for multiple . in the address.

Do comment if you have another simple example or way to do it. Doubts and suggestion are always welcome.

Note: All JS Examples codes are tested on the Firefox browser and the Chrome browser.
OS: Windows 10
Code: HTML 5 Version


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.