I’m using JQuery to get values from a form. When I submit the form I want to make a check on that the user has enterd the same e-mail twice and that the format is correct of the email. I can’t figure out how to do it. Here’s my if-clause which firebug complains at:
$('#subscribe_now').submit(function(event) {
regExp = /^[^@]+@[^@]+$/;
if(($('#email1').val().search(regExp) == -1) || ($('#email1').val() != $('#email2').val())))
return false;
}
else
{
return true
}
}
How should I do this?
Thank you in advance!
1 Answer