While I don't have a specific code snippet to share, I did have an idea and attempted to implement it. Unfortunately, it didn't yield the desired results.
const validateEmailAddress = function (e) {
const regex =
/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:.[a-zA-Z0-9-]+)*$/;
e.preventDefault();
if (!regex.test(inputEmail.value)) {
this.classList.toggle(".error");
} else {
return (inputEmail.value = "");
}
};
form.addEventListener("submit", validateEmailAddress, false);