This is a solution to the Newsletter sign-up form with success message challenge on Frontend Mentor. Frontend Mentor challenges help you improve your coding skills by building realistic projects.
Users should be able to:
- Add their email and submit the form
- See a success message with their email after successfully submitting the form
- See form validation messages if:
- The field is left empty
- The email address is not formatted correctly
- View the optimal layout for the interface depending on their device's screen size
- See hover and focus states for all interactive elements on the page
- Semantic HTML5 markup
- CSS custom properties
- Flexbox
- CSS Grid
- Mobile-first workflow
- JavaScript
- Tailwind CSS
- DOM Manipulation
I learned how to use JavaScript to toggle the error states of the form and display the success message. This was
function switchSections(){
signup.classList.toggle("hide");
success.classList.toggle("hide");
}
During this project, there were times when I got stuck with the JavaScript portion of the project (more specifically, getting the success message to display after form submission and toggling the error message). But after overcoming those issues, I got slightly more comfortable with understanding how to make functions and using id elements to manipulate the DOM.