I am using the following javascript regex email validate function but it doen't seem to work why....
function IsValidEmail(email) {
var filter = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
return filter.test(email);
}
function forgetpassword() {
if (document.getElementById("ctl00_TxtEmailId").value == "") {
return false;// this condition gets exected so no prob with my txtboxID
}
if (document.getElementById("ctl00_TxtEmailId").value != "") {
return IsValidEmail(document.getElementById("ctl00_TxtEmailId").value);
}
return true;
}
My failed inputs were test,test@test and also [email protected]
Guys my textbox is within a facebox modal popup.... when i tried alert(document.getElementById("ctl00_TxtEmailId").value
with some text jsadf
the alert displayed with nothing... Why?