
Submitted over 1 year ago
📩 Newsletter Signup With Success State
#accessibility#semantic-ui#sass/scss
@RealKendpr
Design comparison
SolutionDesign
Solution retrospective
This is my function for validating the email, but I don't have error message for validating an empty input field.
Javascript
subForm.addEventListener("submit", (el) => {
el.preventDefault();
if (emailInput.value.match(emailFormat)) {
defaultCard[0].classList.add("hidden");
successCard[0].classList.add("visible");
}
});
This is the html
<div class="input-wrapper">
<input
type="email"
name="email"
id="email"
placeholder="email@company.com"
/>
<div class="input-error-message">Valid email required</div>
</div>```
How did you implement an error message when a user tries to submit an empty input field?
Please log in to post a comment
Log in with GitHubCommunity feedback
No feedback yet. Be the first to give feedback on Kendpr's solution.
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