Code at the top of the Javascript file works, but the ones beneath don't.

Hello guys, i have a terrible problem. i had finished my Javascript code for a Sign-up page (which is attached to a main page) and everything seemed to be working fine but after a while, it stopped. After much debugging i realised that the code at the top of the page which contained a hamburger for the main page was working, while the ones beneath it which allowed you to switch between two forms in the Sign Up page, werent. I interchanged the top & bottom codes and noticed that whichever code was on top was working and the one beneath wasnt. I really need help with this so please help if you can. Codepen: https://codepen.io/will-ndaji/pen/KKbjLKM Thank You
2 Replies
Zoë
Zoë13mo ago
Check the console, F12, click Console tab and you can see the error
Uncaught TypeError: can't access property "addEventListener", hamburger is null
Uncaught TypeError: can't access property "addEventListener", hamburger is null
You can either comment out the hamburger.addEventListener temporarily or turn it into hamburger?.addEventListener if there isn't always hamburger (the ? means that if it is undefined or null it won't try and do anything else and return undefined)
Will45
Will4513mo ago
Thank You Problem Solver, you were a big help.🙏
Want results from more Discord servers?
Add your server