Newsletter sign-up form using HTML, CSS and Vanilla JS

Please log in to post a comment
Log in with GitHubCommunity feedback
- @techyjc
Hi Sergio,
Great work! Just a minor change on your JS. Add a preventDefault to your function.
element.addEventListener("submit", function (e) => {
e.preventDefault;
//Do something;
});
Use the
submit
event rather than click, then you can prevent the default submit behaviour and allow you to process the form information. Add a parame
/event
to your function to capture events.Hope this helps.
Marked as helpful
Join 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