I am trying to make a regex e-mail checker. Here is my code:
document.onkeyup = function(event)
{
userID = $("#email").val();
if (userID.match("[a-zA-Z\d]+\@[a-zA-Z\d]+\.[a-zA-Z\d]+"))
{
$("#emCheck").text("Thank you for your email address!");
$("#emCheck").css("color", "black");
}
else
{
$("#emCheck").text("Please enter a valid email.");
}
}
What's odd is this seems to work for the @ sign, but not the dot. "dennis" is not a valid e-mail, but "dennis@yahoo" is. Why is this? Why does the @ sign work but the dot does not?