Chore Bot Exercise - Step 10

Hi folks,

Happy programming and hope you’re all staying safe. I started doing the exercise, and then immediately got stuck on Step 10 where you get to refresh the page and click on the door to see if it opens up to reveal the bot. I double checked my code, and then I opened up the YouTube video (Get Help) and double checked to see if I got everything right… But while the door click works fine on the video tutorial, it doesn’t work for me. I wanted to know if I am missing something or not… If you see any mistake up until that step, please point it out for me.

The Link to project: https://www.codecademy.com/paths/web-development/tracks/build-interactive-websites/modules/web-dev-interactive-websites/projects/chore-door

HTML:

<!DOCTYPE html>

<html>

  <head>

    <title>Chore Door!</title>

    <link href="./style.css" rel="stylesheet" type="text/css">

    <link href="https://fonts.googleapis.com/css?family=Work+Sans" rel="stylesheet" type="text/css">

  </head>

  <body>

    <div class ="door-row">

      <img id = "door1" src = "https://content.codecademy.com/projects/chore-door/images/closed_door.svg">

    </div>

<script type = "text/javascript" src = "script.js"></script>

  </body>

</html>

CSS:

body {

  background-color: #010165;

  margin: 0px;

}

#door1 {

  cursor: pointer;

}

JS:

let doorImage1 = document.getElemenyById('door1');

let botDoorPath = "https://content.codecademy.com/projects/chore-door/images/robot.svg";

door1.onclick = () => {
  doorImage1.src = botDoorPath;
  };

Your browser has a built-in console (f12), which can help you identify errors. I see a TypeError in my console when running your code:

Uncaught TypeError: document.getElemenyById is not a function

you made a typo/grammar mistake in the method name

1 Like

Scheisse! Thanks for that! And +++ on the f12 function. I will start using that one now as well :slight_smile:

1 Like

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