1644 Reads

Source Code here:

<!DOCTYPE html>
<html>
<head>
</head>
<body>
	<input type="email" id="email" />
    <button onclick="validateEmail()">Validate Email</button>
    
    <script>
    	function validateEmail(){
        	var email = document.getElementById('email').value;
            let regex = /^(([^<>()\[\]\.,;:\s@\"]+(\.[^<>()\[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i;
            if (regex.test(email)) {
                alert('Valid Email Address');
            } else {
            	alert('Invalid Email Address');
            }
        }
    </script>
</body>
</html>