function validateEmail(email)
{
var re = /^(([^<>()[].,;:s@"]+(.[^<>()[].,;:s@"]+)*)|(".+"))@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}])|(([a-zA-Z-0-9]+.)+[a-zA-Z]{2,}))$/;
return re.test(email);
}
function validatePhone(phone)
{
// 880-1710-336617
var re = /^(?(d{3}))?[- ]?(d{4})[- ]?(d{6})$/;
return re.test(phone);
}
$('#button').click(function(){
field = $('#email').val();
//If not an email AND not a phone
if(validateEmail(field))
{
alert('Email Passed');
//show_error_msg('error_signup_email','Enter a valid email address or a phone number');
//jQuery("#signup_email").focus();
return true;
} else if (validatePhone(field)){
alert('Phone Passed');
return true;
}
else alert('Email or Phone Error');
});