Check valid email address by Javascript

Hello Friends,
Hope you are fine. I am fine. Today, I am showing how to check valid email address by using javascript. Its a very primary label work for javascript programmer. This task for javascript beginner. Lets start the work.

<!DOCTYPE html>
<html>
<head>
<title>Learn JavaScrtipt</title>

<script>

function emailchk(){

var x = document.aa.bb.value;

if(x.indexOf(“@”) == -1){
alert(“Please entair a valid email address”);
}

}

</script>
</head>

<body>

<form name=”aa”>

<input type=”text” name=”bb” value=”” placeholder=”Type your email” onBlur=”emailchk()”>
<input type=”text” name=”cc” value=”” placeholder=”Type your phone” onClick=””>

</form>
</body>
</html>

This is the code for all the work. Now, save your fine and run this file. Well, now, your file is ready to use. Just blur your text field and you will see some interactive work by javascript.

Thanks for reading.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s