PDA

View Full Version : Start a new topic add your comments Email validation not working in Int. Explorer



viens
09-23-2009, 04:09 PM
Hello,

Can somebody help me? I don't understand why my script stops working in Internet Explorer if I include the following lines:
=================================


var email = $("input#email").val();
var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (!filter(email)) {
$("label#email_error").show();
$("input#email").focus();
return false;
================================

It works fine with all other browsers.
Thanks.

magicyte
09-24-2009, 03:23 AM
var email = $("input#email").val();
var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (!filter(email)) {
$("label#email_error").show();
$("input#email").focus();
return false;
}

I suppose you just forgot to include the closing bracket in your example code. It's probably in your other code....

Anyways, I'm not sure about this, but filter is not a function (don't know if it is, pretty sure it isn't), just RegEx stuff. I'm not exactly sure what should happen (it should filter, but how?), but it should work in IE if it works in all other browsers... Weird.

viens
09-24-2009, 09:59 AM
Thank you, magicyte.