function validemailcommaseparated()
{
var emailexp = new RegExp(/^([\w+-.%]+@[\w-.]+\.[A-Za-z]{2,4},?)+$/i);
var emailtxt = $('#txtmail').val();
if (!emailexp.test(emailtxt)) {
alert("you have entered an invalid email address!");
$('#txtmail').val(emailtxt.substring(0, emailtxt.lastIndexOf(',')));
return false;
}
else {
return true;
}
}
<!-- call function : onchange = "return validemailcommaseparated();" -->
{
var emailexp = new RegExp(/^([\w+-.%]+@[\w-.]+\.[A-Za-z]{2,4},?)+$/i);
var emailtxt = $('#txtmail').val();
if (!emailexp.test(emailtxt)) {
alert("you have entered an invalid email address!");
$('#txtmail').val(emailtxt.substring(0, emailtxt.lastIndexOf(',')));
return false;
}
else {
return true;
}
}
<!-- call function : onchange = "return validemailcommaseparated();" -->
0 Comments
if you have any doubts , please let me know