Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

CSS Flexbox, media queries for responsive design

lukasdevitā€¢ 40

@lukasdevit

Desktop design screenshot for the Newsletter sign-up form with success message coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
2junior
View challenge

Design comparison


SolutionDesign

Solution retrospective


  • What can I change to make mobile design better?

  • Is my JavaScript overcomplicated?

  • I want negative opinions!!

Community feedback

Akhatmirzoā€¢ 320

@Akhatmirzo

Posted

The state when the button is pressed does not exist! Fix error via javascript.

Marked as helpful

1
Jennifer Souzaā€¢ 340

@zoedarkweather

Posted

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 helpful

1

Please log in to post a comment

Log in with GitHub
Discord logo

Join 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