Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted 7 months ago

Completed the Newsletter Sign Up page

Sameer Mehta•170
@Sameer1003
A solution to the Newsletter sign-up form with success message challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


What specific areas of your project would you like help with?

I would really like help with the following problem that I am unable to resolve in my Javascript code.

Problem:

In my project, I have 2 HTML files, index.html and sign-up-success.html. In index.html, I have a form which on submit takes me to sign-up-success.html page and in sign-up-success.html page I have a dismiss button which I want that on click should redirect again to index.html page. The problem is, that I am using a single Javascript file to handle these two HTML files. But, since initially index.html page will be open, the dismiss button will be undefined and hence the variable assigned to it will give null value. How can i Handle this?

For reference, check line number 2 and line number 54 to 60 in script.js file. These lines are currently commented out.

Any kind of suggestion with any part of my code is appreciated. Please try to be specific with which part improvement is possible.

Code
Loading...

Please log in to post a comment

Log in with GitHub

Community feedback

No feedback yet. Be the first to give feedback on Sameer Mehta's solution.

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

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner
  • Use cases

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License