Responsive html/css site made with grid layout
Design comparison
Solution retrospective
The input gives an error even when the email address entered is valid. Also, the page reloads when the button is pressed without any input.
Anticipating your corrections and feedbacks.. Thanks! :-)
Community feedback
- @Sumner-DavidPosted over 4 years ago
Hey,
For the email address button, try making it a simple button without any type='submit', then on the JS side of this, add an eventListener on click to check if your input field is valid (Probably with some RegEx magic) then if true use JS to submit the form that way. This way it does the check first. You'll need to add a name to your form though for JS to hook onto that.
As for the Reload, that's because the form action is set to action="". This is the same as action="/" which means homepage. So form on submit is redirecting you to hompage which is index.html
Hope that helped :D
0@Sumner-DavidPosted over 4 years agoJust realized i massively overcomplicated that. Just sick the word 'required' on your input form so the submit wont work unless the email is valid
0
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