Email Verification

document.getElementById("myForm").addEventListener("submit", function(e) { e.preventDefault(); validateBulkEmails(); }); function validateBulkEmails() { var emailsInput = document.getElementById("emails").value; var emails = emailsInput.split(",").map(email => email.trim()); var emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; // Regular expression var validEmails = []; var invalidEmails = []; emails.forEach(email => { if (email.match(emailPattern)) { validEmails.push(email); } else { invalidEmails.push(email); } }); var validEmailMessage = "Valid Emails: " + validEmails.join(", "); var invalidEmailMessage = "Invalid Emails: " + invalidEmails.join(", "); document.getElementById("validEmails").innerHTML = validEmailMessage + "
" + invalidEmailMessage; }