var emailsString = "amit.jain@test.com, amit@test.com, aj@test.com";
var emailValidator = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/;
var emails = emailsString.split(",");
var result = false;
var pattern = new RegExp(emailValidator);
$.each(emails, function (i) {
debugger;
if (emails[i] != null && emails[i] != '') {
var email = $.trim(emails[i]);
result = pattern.test(email);
if (!result) {
alert("Enter the valid email(s) and try again !");
return false;
}
}
});
var emailValidator = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/;
var emails = emailsString.split(",");
var result = false;
var pattern = new RegExp(emailValidator);
$.each(emails, function (i) {
debugger;
if (emails[i] != null && emails[i] != '') {
var email = $.trim(emails[i]);
result = pattern.test(email);
if (!result) {
alert("Enter the valid email(s) and try again !");
return false;
}
}
});
Nice !
ReplyDelete