validate email
function validateEmail(email)
{
var re = /^([\w-]+(?:\.[\w-]+))@((?:[\w-]+\.)\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
return re.test(email);
}
var email = Apperyio('txt_mobiletextinput_4').val();
var errorMsg = "";
if ($.trim(email) === "")
{
errorMsg = errorMsg + "Email cannot be blank \n";
}
if (errorMsg === "")
{
restservice2.execute({});
}
else
{
alert("Please fix the following error: \n" + errorMsg);
}
This is the code I am using I want to validate the email and display a error message if the email is not valid. how do I fix the code to do that??