Design comparison
SolutionDesign
Solution retrospective
I used insertAdjacentHTML to display error message but couldn't find any way to remove it after some seconds so after clicking on button again it doesn't display error over and over any solution?
Community feedback
- @aanacifPosted about 3 years ago
I feel your pain, keep pushing tho.
Quite a few different ways you could approach this. Maybe have a look at JS Element.setAttribute(). So you could use the 'hidden' attribute for example.. Or even give the error message a class say 'show'... then use JS classList.toggle to add/remove it. Or even hook it to the form validations. Have a look at oninvalid event for the inputs...
Hope that helps :)
Marked as helpful0
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