javascript email validation

How we can check a valid Email provide by users using JavaScript? Solution: JavaScript Email Validation With CSS UI, Email Validate JS Program.

Previously I have shared a form validation using JavaScript or Query, But this is only for validating email. I also have shared a Pure HTML CSS Form Validation without JS, you can check it also. Basically, Email Validation is a procedure that verifies if an email address is deliverable and valid.

Today you will learn to create an Email Validate program using pure JS. This program will help you to create a perfect email field to avoid invalid email inputs. There are some conditions like, you have put some characters before @, and @ is required, after that you need two or three char before .com, etc.

So, Today I am sharing JavaScript Email Validation With CSS UI. There is a rectangle type box with headings, and email fields, and a button for validating. And also there are another two massages for valid and invalid email info. But there is only one field for put email, if you want full form then you can check out above in the first line of the paragraph.

If you are thinking now how this email validation actually is, then see the preview given below.

Preview Of Email Validate JS

See this video to getting an idea of how this program looks like.

Live Demo

Now you can see this visually, you also can see it live by pressing the button given above. If you like this program, then get the source code of its.

You May Also Like:

JavaScript Email Validation With CSS UI Source Code

Before sharing source code, let’s talk about it. First I have created an HTML form with two inputs, one text input and one is button input. After that, create two divs for massages, one for valid massage and other for invalid massage. And for font, used a google font and linked in HTML file.

Using CSS, I have placed all elements in the right place. Also gave a red theme for invalid email massage and green theme for valid massage. As you know the full program is based on JavaScript, actually JS has done the main work. First JavaScript checks the email according to condition, then fetched the massage divs.

After checking the Email, there is an If & Else condition (info). If the email is valid then JS show the valid message and hide the invalid massage’s div. Then do the same thing when the email is invalid. I can’t explain more in writing, you will understand easily after getting the codes. For creating this program you have to create 3 files, first for HTML, second for CSS, and third for JS. Follow the steps to creating this without any error.

index.html

Create an HTML file ‘index.html‘ and put these codes given here below.

style.css

Now create a CSS file named ‘style.css‘ and put these codes given here.

function.js

The final step, Create a JavaScript file named ‘function.js‘ and put the codes.

That’s It. Now you have successfully created JavaScript Email Validation With CSS UI, Email Validate JS Program. If you have any doubt or question comment down below.

Thanks For Visiting, Keep Visiting.

LEAVE A REPLY

Please enter your comment!
Please enter your name here