Chore door exercise - doors won't open

Hello everyone, my issue is with the chore door exercise, LINK TO EXERCISE HERE .

When I reached task 10 where I had to use onclick, the door didn’t open.

I thought it was an issue with my code so I checked what others had done and I had done the same. I still checked and copied and pasted the whole project from someone to see if the issue was with my code but still, it didn’t work.

I thought it may be an issue caused Chrome so I tried on Mozilla and Edge as well but still, the doors won’t open.

Anyone has any idea of what the issue could be? Thank you!

Small mistaken are often missed. Could you please post your code using the </> code formatter?

Hello and thank you for your quick reply. I used the following code to test if the issue came from my code or from something else, I deleted everything I did and used this: https://github.com/namvdo/chore-door-game-codecademy-project

Have you checked the console for errors?

There’s one error, Failed to load resource: the server responded with a status of 404 () index.js:1

There you go, if it cant load the Javascript the doors won’t open. Are your links from the html to the javascript correct?

1 Like

I see. His version has problems with links and mine probably did too. Thank you. I’ll remember to check the console from now on!

His links are actually right on. He links to index.js in his HTML. However in the Codecademy sandbox the Javascript file is called script.js as stated in the assignment.

All JavaScript logic will be written within the script.js file but in order to have that logic interact with the HTML, you first need to establish a connection between the script.js page and the index.html. In the index.html page, create a <script> element directly above the closing </body> tag. Inside the opening <script> tag, set the type as "text/javascript" and the src as "script.js". Then immediately close the element with a </script> tag.

So as I said small mistakes are easily missed. I suggest you backtrack to your original code and check the links. Then start building again from there.

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.