CSS Flexbox, media queries for responsive design
Design comparison
Solution retrospective
-
What can I change to make mobile design better?
-
Is my JavaScript overcomplicated?
-
I want negative opinions!!
Community feedback
- @AkhatmirzoPosted about 1 year ago
The state when the button is pressed does not exist! Fix error via javascript.
Marked as helpful1 - @zoedarkweatherPosted about 1 year ago
Hi, I'd say "maybe" to too complicated JS? Probably putting it in one file would improve readability and maintainability. Also, you have duplicate code - page.js and newsletterFormSignIn appear to be the same file with different names. One thing - you can hide the success message using absolute positioning and moving it offscreen to avoid writing a bunch of html with your JS and that would simplify things a lot. Another thing I'd point out is that you can simplify your validation - you have your input set to type email and you made it required, so you don't need to test against any regex or anything. You can use the built-in Constraint Validation API. So you'd test input.validity.valid which returns a boolean indicating if it is violating any constraints - in this case missing or not an email. You could test further as validity returns a validity state (eg typeMismatch or valueMissing), but in this case you don't need to get more detailed since you're setting the same error message no matter if empty or not an email. Hope this is helpful.
Marked as helpful1
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