SlideShare a Scribd company logo
1 of 10
Download to read offline
Validate Email
with JavaScript
https://emailconcern.com
What is
JavaScript Javascript is a scripting computer
language and its abbreviation is JS. It is
used to develop complex web
applications However it is always used
with CSS and HTML. It is different from
the Java computer language.
https://emailconcern.com
Why Validate
Email Address
In today’s world, most of the
important communication is done
through Email addresses. Collecting
email addresses is not only important
but it becomes essential when it
comes to Email Marketing. Therefore
validating the email address becomes
mandatory.
https://emailconcern.com
Structure of
Email Address
Consider this email address as a
sample ContactUs@EmailConcern.com. It is a
valid email address. Now it consists of 3 parts
1.Before @ :: It consists of the name of the
email address. This part consists of letters
(capital as well as small), numbers, and
special characters.
2.After @ :: It consists of a domain name so
here you can use (capital as well as small),
numbers, and special characters.
3.After dot :: It defines the type of the domain
like com, org, etc. In this part, only letters
(capital as well as small), numbers, and
dot(optional) can appear.
If any of the structures is violated the email
address becomes invalid.
https://emailconcern.com
Validate Email with JavaScript
<!DOCTYPE html>
<html>
<body>
<h1>Validate Email with JavaScript</h1>
<input id="EmailAddress">
<button type="button"
onclick="VALIDATE_EMAIL_ADDRESS()">Submit</button>
<h2 id="Result" style="color: Green;"></h2>
https://emailconcern.com
Validate Email with JavaScript
<script>
function VALIDATE_EMAIL_ADDRESS() {
var email;
email = document.getElementById("EmailAddress").value;
var reg = /^([A-Za-z0-9_-.])+@([A-Za-z0-9_-.])+.([A-Za-
z]{2,4})$/;
if (reg.test(EmailAddress.value) == false)
{
https://emailconcern.com
Validate Email with JavaScript
document.getElementById("Result").style.color = "red";
document.getElementById("Result").innerHTML ="Invalid
EMail Address "+ email;
return false;
}
else
{
document.getElementById("Result").style.color = "Green";
https://emailconcern.com
Validate Email with JavaScript
document.getElementById("Result").innerHTML ="Valid Email
Address"+email;
}
return true;
}
</script>
</body>
</html>
https://emailconcern.com
Validate Email
with JavaScript
To test the above mention code I used W3School JavaScript
online editor. In this editor just paste the code into the editor
and press the Run button.
https://emailconcern.com
Conclusion
In order to collect valid email addresses, this validation is mandatory.
You cannot skip this step. It not only makes things easy for you but
also ensures data integrity.
https://emailconcern.com

More Related Content

Similar to Validate Email with JavaScript

PHP Form Validation Technique
PHP Form Validation TechniquePHP Form Validation Technique
PHP Form Validation TechniqueMorshedul Arefin
 
How To Build A Bulk Email Sending Application In PHP
How To Build A Bulk Email Sending Application In PHPHow To Build A Bulk Email Sending Application In PHP
How To Build A Bulk Email Sending Application In PHPSudheer Satyanarayana
 
Email Validation for Improved Deliverability and Marketing Results
Email Validation for Improved Deliverability and Marketing ResultsEmail Validation for Improved Deliverability and Marketing Results
Email Validation for Improved Deliverability and Marketing ResultsScott Valentine, MBA, CSPO
 
LAPHP/LAMPSig Talk: Intro to SendGrid - Building a Scalable Email Infrastructure
LAPHP/LAMPSig Talk: Intro to SendGrid - Building a Scalable Email InfrastructureLAPHP/LAMPSig Talk: Intro to SendGrid - Building a Scalable Email Infrastructure
LAPHP/LAMPSig Talk: Intro to SendGrid - Building a Scalable Email InfrastructureSendGrid
 
GCSECS-DefensiveDesign.pptx
GCSECS-DefensiveDesign.pptxGCSECS-DefensiveDesign.pptx
GCSECS-DefensiveDesign.pptxazida3
 
Php forms and validations by naveen kumar veligeti
Php forms and validations by naveen kumar veligetiPhp forms and validations by naveen kumar veligeti
Php forms and validations by naveen kumar veligetiNaveen Kumar Veligeti
 
Action Mailer In Action
Action Mailer In ActionAction Mailer In Action
Action Mailer In ActionRob Kaufman
 
HTML email design and usability
HTML email design and usabilityHTML email design and usability
HTML email design and usabilityKeith Kmett
 
Tips & tricks to render your email correctly on all devices
Tips & tricks to render your email correctly on all devicesTips & tricks to render your email correctly on all devices
Tips & tricks to render your email correctly on all devicesCopernica BV
 
EMarketing Techniques Conference_Emailmarketingessentials May2008
EMarketing Techniques Conference_Emailmarketingessentials May2008EMarketing Techniques Conference_Emailmarketingessentials May2008
EMarketing Techniques Conference_Emailmarketingessentials May2008Corporate College
 
full stack practical assignment msc cs.pdf
full stack practical assignment msc cs.pdffull stack practical assignment msc cs.pdf
full stack practical assignment msc cs.pdfHulkTheDevil
 
Pranavi verma-class-9-email-messaging
Pranavi verma-class-9-email-messagingPranavi verma-class-9-email-messaging
Pranavi verma-class-9-email-messagingPranaviVerma
 
Pranavi verma-it 402 class ix-unit 11_presentation
Pranavi verma-it 402 class ix-unit 11_presentationPranavi verma-it 402 class ix-unit 11_presentation
Pranavi verma-it 402 class ix-unit 11_presentationPranaviVerma
 
Email Design Workshop - Don't Let Bad Email Code Ruin Your Day or Your Results
Email Design Workshop - Don't Let Bad Email Code Ruin Your Day or Your ResultsEmail Design Workshop - Don't Let Bad Email Code Ruin Your Day or Your Results
Email Design Workshop - Don't Let Bad Email Code Ruin Your Day or Your ResultsShana Masterson
 
Html advanced-reference-guide for creating web forms
Html advanced-reference-guide for creating web formsHtml advanced-reference-guide for creating web forms
Html advanced-reference-guide for creating web formssatish 486
 

Similar to Validate Email with JavaScript (20)

PHP Form Validation Technique
PHP Form Validation TechniquePHP Form Validation Technique
PHP Form Validation Technique
 
How To Build A Bulk Email Sending Application In PHP
How To Build A Bulk Email Sending Application In PHPHow To Build A Bulk Email Sending Application In PHP
How To Build A Bulk Email Sending Application In PHP
 
Email Validation for Improved Deliverability and Marketing Results
Email Validation for Improved Deliverability and Marketing ResultsEmail Validation for Improved Deliverability and Marketing Results
Email Validation for Improved Deliverability and Marketing Results
 
Handout7 html forms
Handout7 html formsHandout7 html forms
Handout7 html forms
 
LAPHP/LAMPSig Talk: Intro to SendGrid - Building a Scalable Email Infrastructure
LAPHP/LAMPSig Talk: Intro to SendGrid - Building a Scalable Email InfrastructureLAPHP/LAMPSig Talk: Intro to SendGrid - Building a Scalable Email Infrastructure
LAPHP/LAMPSig Talk: Intro to SendGrid - Building a Scalable Email Infrastructure
 
GCSECS-DefensiveDesign.pptx
GCSECS-DefensiveDesign.pptxGCSECS-DefensiveDesign.pptx
GCSECS-DefensiveDesign.pptx
 
Php forms and validations by naveen kumar veligeti
Php forms and validations by naveen kumar veligetiPhp forms and validations by naveen kumar veligeti
Php forms and validations by naveen kumar veligeti
 
week 3 slides.pptx
week 3 slides.pptxweek 3 slides.pptx
week 3 slides.pptx
 
Email Marketing
Email MarketingEmail Marketing
Email Marketing
 
Action Mailer In Action
Action Mailer In ActionAction Mailer In Action
Action Mailer In Action
 
HTML email design and usability
HTML email design and usabilityHTML email design and usability
HTML email design and usability
 
Tips & tricks to render your email correctly on all devices
Tips & tricks to render your email correctly on all devicesTips & tricks to render your email correctly on all devices
Tips & tricks to render your email correctly on all devices
 
Html forms
Html formsHtml forms
Html forms
 
EMarketing Techniques Conference_Emailmarketingessentials May2008
EMarketing Techniques Conference_Emailmarketingessentials May2008EMarketing Techniques Conference_Emailmarketingessentials May2008
EMarketing Techniques Conference_Emailmarketingessentials May2008
 
full stack practical assignment msc cs.pdf
full stack practical assignment msc cs.pdffull stack practical assignment msc cs.pdf
full stack practical assignment msc cs.pdf
 
Pranavi verma-class-9-email-messaging
Pranavi verma-class-9-email-messagingPranavi verma-class-9-email-messaging
Pranavi verma-class-9-email-messaging
 
Pranavi verma-it 402 class ix-unit 11_presentation
Pranavi verma-it 402 class ix-unit 11_presentationPranavi verma-it 402 class ix-unit 11_presentation
Pranavi verma-it 402 class ix-unit 11_presentation
 
Email Design Workshop - Don't Let Bad Email Code Ruin Your Day or Your Results
Email Design Workshop - Don't Let Bad Email Code Ruin Your Day or Your ResultsEmail Design Workshop - Don't Let Bad Email Code Ruin Your Day or Your Results
Email Design Workshop - Don't Let Bad Email Code Ruin Your Day or Your Results
 
HTML Email
HTML EmailHTML Email
HTML Email
 
Html advanced-reference-guide for creating web forms
Html advanced-reference-guide for creating web formsHtml advanced-reference-guide for creating web forms
Html advanced-reference-guide for creating web forms
 

Recently uploaded

BDSM⚡Call Girls in Sector 144 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 144 Noida Escorts >༒8448380779 Escort ServiceBDSM⚡Call Girls in Sector 144 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 144 Noida Escorts >༒8448380779 Escort ServiceDelhi Call girls
 
Brand experience Peoria City Soccer Presentation.pdf
Brand experience Peoria City Soccer Presentation.pdfBrand experience Peoria City Soccer Presentation.pdf
Brand experience Peoria City Soccer Presentation.pdftbatkhuu1
 
Five Essential Tools for International SEO - Natalia Witczyk - SearchNorwich 15
Five Essential Tools for International SEO - Natalia Witczyk - SearchNorwich 15Five Essential Tools for International SEO - Natalia Witczyk - SearchNorwich 15
Five Essential Tools for International SEO - Natalia Witczyk - SearchNorwich 15SearchNorwich
 
Situation Analysis | Management Company.
Situation Analysis | Management Company.Situation Analysis | Management Company.
Situation Analysis | Management Company.DanielaQuiroz63
 
Defining Marketing for the 21st Century,kotler
Defining Marketing for the 21st Century,kotlerDefining Marketing for the 21st Century,kotler
Defining Marketing for the 21st Century,kotlerAmirNasiruog
 
Unraveling the Mystery of The Circleville Letters.pptx
Unraveling the Mystery of The Circleville Letters.pptxUnraveling the Mystery of The Circleville Letters.pptx
Unraveling the Mystery of The Circleville Letters.pptxelizabethella096
 
Brighton SEO April 2024 - The Good, the Bad & the Ugly of SEO Success
Brighton SEO April 2024 - The Good, the Bad & the Ugly of SEO SuccessBrighton SEO April 2024 - The Good, the Bad & the Ugly of SEO Success
Brighton SEO April 2024 - The Good, the Bad & the Ugly of SEO SuccessVarn
 
Brand experience Dream Center Peoria Presentation.pdf
Brand experience Dream Center Peoria Presentation.pdfBrand experience Dream Center Peoria Presentation.pdf
Brand experience Dream Center Peoria Presentation.pdftbatkhuu1
 
Social Media Marketing PPT-Includes Paid media
Social Media Marketing PPT-Includes Paid mediaSocial Media Marketing PPT-Includes Paid media
Social Media Marketing PPT-Includes Paid mediaadityabelde2
 
How to Leverage Behavioral Science Insights for Direct Mail Success
How to Leverage Behavioral Science Insights for Direct Mail SuccessHow to Leverage Behavioral Science Insights for Direct Mail Success
How to Leverage Behavioral Science Insights for Direct Mail SuccessAggregage
 
Social Samosa Guidebook for SAMMIES 2024.pdf
Social Samosa Guidebook for SAMMIES 2024.pdfSocial Samosa Guidebook for SAMMIES 2024.pdf
Social Samosa Guidebook for SAMMIES 2024.pdfSocial Samosa
 
Enjoy Night⚡Call Girls Dlf City Phase 4 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 4 Gurgaon >༒8448380779 Escort ServiceEnjoy Night⚡Call Girls Dlf City Phase 4 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 4 Gurgaon >༒8448380779 Escort ServiceDelhi Call girls
 
Instant Digital Issuance: An Overview With Critical First Touch Best Practices
Instant Digital Issuance: An Overview With Critical First Touch Best PracticesInstant Digital Issuance: An Overview With Critical First Touch Best Practices
Instant Digital Issuance: An Overview With Critical First Touch Best PracticesMedia Logic
 
The+State+of+Careers+In+Retention+Marketing-2.pdf
The+State+of+Careers+In+Retention+Marketing-2.pdfThe+State+of+Careers+In+Retention+Marketing-2.pdf
The+State+of+Careers+In+Retention+Marketing-2.pdfSocial Samosa
 

Recently uploaded (20)

BDSM⚡Call Girls in Sector 144 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 144 Noida Escorts >༒8448380779 Escort ServiceBDSM⚡Call Girls in Sector 144 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 144 Noida Escorts >༒8448380779 Escort Service
 
No Cookies No Problem - Steve Krull, Be Found Online
No Cookies No Problem - Steve Krull, Be Found OnlineNo Cookies No Problem - Steve Krull, Be Found Online
No Cookies No Problem - Steve Krull, Be Found Online
 
Brand experience Peoria City Soccer Presentation.pdf
Brand experience Peoria City Soccer Presentation.pdfBrand experience Peoria City Soccer Presentation.pdf
Brand experience Peoria City Soccer Presentation.pdf
 
Five Essential Tools for International SEO - Natalia Witczyk - SearchNorwich 15
Five Essential Tools for International SEO - Natalia Witczyk - SearchNorwich 15Five Essential Tools for International SEO - Natalia Witczyk - SearchNorwich 15
Five Essential Tools for International SEO - Natalia Witczyk - SearchNorwich 15
 
BUY GMAIL ACCOUNTS PVA USA IP INDIAN IP GMAIL
BUY GMAIL ACCOUNTS PVA USA IP INDIAN IP GMAILBUY GMAIL ACCOUNTS PVA USA IP INDIAN IP GMAIL
BUY GMAIL ACCOUNTS PVA USA IP INDIAN IP GMAIL
 
Situation Analysis | Management Company.
Situation Analysis | Management Company.Situation Analysis | Management Company.
Situation Analysis | Management Company.
 
How to Create a Social Media Plan Like a Pro - Jordan Scheltgen
How to Create a Social Media Plan Like a Pro - Jordan ScheltgenHow to Create a Social Media Plan Like a Pro - Jordan Scheltgen
How to Create a Social Media Plan Like a Pro - Jordan Scheltgen
 
SEO Master Class - Steve Wiideman, Wiideman Consulting Group
SEO Master Class - Steve Wiideman, Wiideman Consulting GroupSEO Master Class - Steve Wiideman, Wiideman Consulting Group
SEO Master Class - Steve Wiideman, Wiideman Consulting Group
 
Defining Marketing for the 21st Century,kotler
Defining Marketing for the 21st Century,kotlerDefining Marketing for the 21st Century,kotler
Defining Marketing for the 21st Century,kotler
 
Unraveling the Mystery of The Circleville Letters.pptx
Unraveling the Mystery of The Circleville Letters.pptxUnraveling the Mystery of The Circleville Letters.pptx
Unraveling the Mystery of The Circleville Letters.pptx
 
Brighton SEO April 2024 - The Good, the Bad & the Ugly of SEO Success
Brighton SEO April 2024 - The Good, the Bad & the Ugly of SEO SuccessBrighton SEO April 2024 - The Good, the Bad & the Ugly of SEO Success
Brighton SEO April 2024 - The Good, the Bad & the Ugly of SEO Success
 
Brand experience Dream Center Peoria Presentation.pdf
Brand experience Dream Center Peoria Presentation.pdfBrand experience Dream Center Peoria Presentation.pdf
Brand experience Dream Center Peoria Presentation.pdf
 
Social Media Marketing PPT-Includes Paid media
Social Media Marketing PPT-Includes Paid mediaSocial Media Marketing PPT-Includes Paid media
Social Media Marketing PPT-Includes Paid media
 
Digital Strategy Master Class - Andrew Rupert
Digital Strategy Master Class - Andrew RupertDigital Strategy Master Class - Andrew Rupert
Digital Strategy Master Class - Andrew Rupert
 
How to Leverage Behavioral Science Insights for Direct Mail Success
How to Leverage Behavioral Science Insights for Direct Mail SuccessHow to Leverage Behavioral Science Insights for Direct Mail Success
How to Leverage Behavioral Science Insights for Direct Mail Success
 
Social Samosa Guidebook for SAMMIES 2024.pdf
Social Samosa Guidebook for SAMMIES 2024.pdfSocial Samosa Guidebook for SAMMIES 2024.pdf
Social Samosa Guidebook for SAMMIES 2024.pdf
 
Enjoy Night⚡Call Girls Dlf City Phase 4 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 4 Gurgaon >༒8448380779 Escort ServiceEnjoy Night⚡Call Girls Dlf City Phase 4 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 4 Gurgaon >༒8448380779 Escort Service
 
Foundation First - Why Your Website and Content Matters - David Pisarek
Foundation First - Why Your Website and Content Matters - David PisarekFoundation First - Why Your Website and Content Matters - David Pisarek
Foundation First - Why Your Website and Content Matters - David Pisarek
 
Instant Digital Issuance: An Overview With Critical First Touch Best Practices
Instant Digital Issuance: An Overview With Critical First Touch Best PracticesInstant Digital Issuance: An Overview With Critical First Touch Best Practices
Instant Digital Issuance: An Overview With Critical First Touch Best Practices
 
The+State+of+Careers+In+Retention+Marketing-2.pdf
The+State+of+Careers+In+Retention+Marketing-2.pdfThe+State+of+Careers+In+Retention+Marketing-2.pdf
The+State+of+Careers+In+Retention+Marketing-2.pdf
 

Validate Email with JavaScript

  • 2. What is JavaScript Javascript is a scripting computer language and its abbreviation is JS. It is used to develop complex web applications However it is always used with CSS and HTML. It is different from the Java computer language. https://emailconcern.com
  • 3. Why Validate Email Address In today’s world, most of the important communication is done through Email addresses. Collecting email addresses is not only important but it becomes essential when it comes to Email Marketing. Therefore validating the email address becomes mandatory. https://emailconcern.com
  • 4. Structure of Email Address Consider this email address as a sample ContactUs@EmailConcern.com. It is a valid email address. Now it consists of 3 parts 1.Before @ :: It consists of the name of the email address. This part consists of letters (capital as well as small), numbers, and special characters. 2.After @ :: It consists of a domain name so here you can use (capital as well as small), numbers, and special characters. 3.After dot :: It defines the type of the domain like com, org, etc. In this part, only letters (capital as well as small), numbers, and dot(optional) can appear. If any of the structures is violated the email address becomes invalid. https://emailconcern.com
  • 5. Validate Email with JavaScript <!DOCTYPE html> <html> <body> <h1>Validate Email with JavaScript</h1> <input id="EmailAddress"> <button type="button" onclick="VALIDATE_EMAIL_ADDRESS()">Submit</button> <h2 id="Result" style="color: Green;"></h2> https://emailconcern.com
  • 6. Validate Email with JavaScript <script> function VALIDATE_EMAIL_ADDRESS() { var email; email = document.getElementById("EmailAddress").value; var reg = /^([A-Za-z0-9_-.])+@([A-Za-z0-9_-.])+.([A-Za- z]{2,4})$/; if (reg.test(EmailAddress.value) == false) { https://emailconcern.com
  • 7. Validate Email with JavaScript document.getElementById("Result").style.color = "red"; document.getElementById("Result").innerHTML ="Invalid EMail Address "+ email; return false; } else { document.getElementById("Result").style.color = "Green"; https://emailconcern.com
  • 8. Validate Email with JavaScript document.getElementById("Result").innerHTML ="Valid Email Address"+email; } return true; } </script> </body> </html> https://emailconcern.com
  • 9. Validate Email with JavaScript To test the above mention code I used W3School JavaScript online editor. In this editor just paste the code into the editor and press the Run button. https://emailconcern.com
  • 10. Conclusion In order to collect valid email addresses, this validation is mandatory. You cannot skip this step. It not only makes things easy for you but also ensures data integrity. https://emailconcern.com