[jQuery] Form Validation
[jQuery] Form Validation
I have just started using jQuery and wonder if you could help me
please.
I am working on a form which contains a field to enter multi-email
addresses. How could I validate this field using jQuery?
This is what I would do if I were not using the jQuery library
function multiEmail(my_emails) {
var email = my_emails.split(';');
for (var i = 0; i < email.length; i++) {
if (!validateEmail(email[i], "Your email is invalid.", 0)) {
return false;
}
}
return true;
}
function validateEmail(email, msg) {....}
How could I customize the function above to go inside the addMethod
below?
jQuery.validator.addMethod("multiEmail", function(...) {
}