Having troubles with my email validation code. I keep on getting the error that my function is not defined. i have made a javascript file for the java code and then i used the onchange in my html to trigger the function.
    <input type="text" id="email" name="email" onchange="check();" />
    function check() {
email = document.getElementById("email").value;
filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (filter.test(email.value)) 
    {
    document.getElementById("email").style.border = "3px solid green";  
    return true;
    }
else
    {
    document.getElementById("email").style.border = "3px solid red";
    return false;
    }
}
 
     
     
     
     
    