Off-freeCodeCamp JavaScript Help

Hi! This isn’t freecodecamp related, but I am trying to build a basic website on replit just as practice and whenever I try to add an event listener it comes back with this error:
TypeError: Cannot read properties of null (reading ‘addEventListener’)Replit

I’m not really sure what is wrong but it would be amazing if anyone wants to take a look?

Hi @clara.s.doyle

This may mean that your code doesn’t have the correct id for the button element.

You can debug by inspecting the html and cross referencing it with the const declaration and .addEventListener

Happy coding

Hi! Thank you so much!! I have tried fixing it and it still doesn’t work. I really don’t understand what is happening, no matter what I try it doesn’t work. I think there are so many things wrong with it so I don’t really know where to start but even the buttons to take the user back to the home page when they are on the sign up or log in page don’t work. Is there any way you could look at it again and let me know what is wrong?

Okay I have an update, I think the problem is with how I am linking my JavaScript file because whenever I run my program I get the error that my functions aren’t defined/can’t be found. Other than that I still have no clue what is wrong.

Hi @clara.s.doyle

EDIT: for the old version
In your login.html file I noticed you have a button element without an onclick attribute.

<button id="logInSubmitButton">Submit</button>

You also have a logInSumbitButton.js which does not appear to have anything linked to it.

Try placing a dot before the forward slash.

<script src="/script.js"></script>

Happy coding