email validation javascript control example
Example: email validation js
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<form method="post" action="">
Email:<input type="text" id="email" onkeyup="validation()">
</form>
</body>
<script type="text/javascript">
function validation(){
var email=document.getElementById("email").value;
var emailpattern=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;
if(emailpattern.test(email))
{
document.getElementById("email").style.backgroundColor='yellow';
}
else
{
document.getElementById("email").style.backgroundColor='red'; }
}
</script>
</html>