I'm using this code in mvc for email validation but after we typed @ of any text in textbox for example : abc@ after @ validation is not wokring and form is submit without validation error.
if (!isValidEmailAddress(email))
{
$('.error').css("display", "block");
isValid == false
}
else
{
$('.error').css("display", "none");
}
function isValidEmailAddress(emailAddress)
{
var res = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
return res.test(emailAddress);
}
Use u+0040
uni-code instead of @
.