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.