I have a registration that does email validation in the focusout event in Input. This validation works perfectly. Now there is a need to validate multiple emails within the same Input, separating by ";" and how could you handle each email at once?
$("#cobrancaEmail").focusout(function () {
var valor = $("#cobrancaEmail").val();
//valida se o email é válido
if (validaEmailIE(valor)) {
$("#cobrancaEmail").css({ "border-color": "blue", "padding": "1px" });
$("#errocobrancaEmail").html("");
} else {
$("#cobrancaEmail").css({ "border-color": "red", "padding": "1px" });
$("#errocobrancaEmail").html("E-mail inválido!");
}
});
function validaEmailIE(email) {
var regex = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
return regex.test(email);
}