

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to validate email address in JavaScript?
To validate email address in JavaScript, check the condition for “@” and “.” i.e. for abc@gmail.com . Let’s try the following code to validate email
Example
<!DOCTYPE html> <html> <body> <script> var emailID; function validateEmail(emailID) { atpos = emailID.indexOf("@"); dotpos = emailID.lastIndexOf("."); if (atpos < 1 || ( dotpos - atpos < 2 )) { document.write("Please enter correct email ID") document.myForm.EMail.focus() ; return false; } return( true ); } document.write(validateEmail("abc@gmail.com")); </script> </body> </html>
- Related Questions & Answers
- Validate Email address in Java
- Python program to validate email address
- How to validate an email address in PHP ?
- How to validate an email address in C#?
- How to validate an email address using Java regular expressions.
- How to validate Email Address in Android on EditText using Kotlin?
- How to validate URL address in JavaScript?
- How to validate email using jQuery?
- Validate IP Address in C#
- Validate IP Address in C++
- Validate IP Address in Python
- How to validate the IP address using PowerShell?
- C Program to validate an IP address
- Python program to validate postal address format
- How to select domain name from email address in MySQL?
Advertisements