ping-coming-soon-page-master with scss
Design comparison
Solution retrospective
-
How to judge the validity of the email, and trigger the modified error prompt?
let submit = document.querySelector("input[type=submit]"); function logevent(event) { event.preventDefault(); let email = document.querySelector("input[type=email]"); let form = document.querySelector("form");
function loginput(event) { form.classList.remove("invalid-email"); // console.log("aaa"); email.removeEventListener("input", loginput); }
if (!email.validity.valid) { form.classList.add("invalid-email"); email.addEventListener("input", loginput); } else { form.classList.remove("invalid-email"); } }
submit.addEventListener("click", logevent);
Community feedback
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord