intro component with signup form: CSS and JavaScript for validation
Design comparison
Solution retrospective
This was my first attempt at form validation using JavaScript. After a little research on a few different ways to do it i used this one where each input element is in an array, and using the forEach() method to cycle through each element of the form. I then used if and else statements to validate the input using regex that id saved to variables.
I used nextElementSibling to access the error message of each input container and removed the hidden class on the error message when the input validation fails.
I could not get the footer to be placed 15px from the bottom (on mobile, desktop works) using position: absolute like i normally do. I tried everything and I'm stumped. So i just added a display: none attribute to the footer class for mobile.
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