Email Validation using HTML, CSS and JavaScript - Code With Bishal (Using Bootstrap)

Learn how to validate E-Mail using JavaScript

In this example you can learn HOW TO VALIDATE EMAIL USING JS By Code With Bishal . Just Copy The Code From Here And Paste It Into Your Website and also don't forget to link the Bootstrap CSS. To Preview scroll the page. If you are having any problem viewing the code just refresh the page Validate Email is a lightweight and easy-to-use JS code that creates a Email validator. In this blog, there are four sections on the webpage, in the first section you can get the overview of the blog, in the second section there are few more coding blogs you might like,in the third section you can see the demo of the JS E-Mail validation using Bootstrap, after that you can copy the code and paste it [that's the fourth section]

You might like this :

Budget Calculator - using JS (JavaScript) and Bootstrap
Few days ago
Show current time using JS
Few days ago
DIV ANIMATION with the help of HTML5 AND CSS
Few days ago

This is an example


<!DOCTYPE html>
<title>JavaScript Form Validation - Code With Bishal</title>
/* by Code With Bishal -*/
<div class="container">
<div class="py-5 text-center">
<label for="email-cwb">
<h3>Email Validation using HTML, CSS and JavaScript</h3>
<form action="">
<div class="field">
<input onkeyup="check()" id="email-cwb" class="form-control" type="text" autocomplete="off" placeholder="Enter Email Address">
<div class="icons">
<div class="icon1-cwb alert alert-danger" role="alert">Enter Valid Email</div>
<div class="icon2-cwb alert alert-success" role="alert">Valid Email</div>
<button class="btn btn-primary">Submit</button>
Copy Contents

CSS Code

display: none;


.icon2-cwb{ display: none;

display: none;

JS(Javascript) Code

const email = document.querySelector("#email-cwb");
const failed = document.querySelector(".icon1-cwb");
const success = document.querySelector(".icon2-cwb");
const btn = document.querySelector(".btn-primary");
let cwb = /^[^ ][email protected][^ ]+\.[a-z]{2,3}$/;
function check(){

if(email.value.match(cwb)){ = "#27ae60"; = "#eafaf1"; = "none"; = "block"; = "block";
}else{ = "#e74c3c"; = "#fceae9"; = "block"; = "none"; = "none";

if(email.value == ""){ = "lightgrey"; = "#fff"; = "none"; = "none"; = "none";