JavaScript Treehouse Club - MASH MASH - HTML MASH Introduction with HTML

Maria Te
Maria Te
8,517 Points

What's going on with the Javascript?

I've been tinkering around with this thing. I added the CSS and Javascript code but I have a few problems. I understand the CSS part but I don't know how to do Javascript so I am so confused with it. Can someone tell me what's going on with the Javascript in this thing?

Steven Parker
Steven Parker
173,784 Points

You would need to share your code to make it possible for someone to offer help with it. One of the best ways to share is to make a snapshot (note: not "screenshot") of your workspace and post the link to it here.

4 Answers

Steven Parker
Steven Parker
173,784 Points

There's several issues here, including:

  • on line 53 of "index.html" the name of the script file is missing (the quotes should contain "script.js")
  • in "scirpt.js" on line 32 the selector is for the id "home" but no element exists with that ID in the HTML
  • on line 34, the same problem happens because no element has the ID of "pet"
  • same again on line 41, no element has the ID of "location"
  • on line 55, "getAnswer" is called with "profession" as the category, but in the HTML it is spelled "proffesion"

Hopefully that will get you going again and you can take it from here.

Maria Te
Maria Te
8,517 Points

By the way for the first 2 things that you said helped, but the others I just changed the properties to make it my own. But thanks, that kind of helped! :-l

Steven Parker
Steven Parker
173,784 Points

It's fine to change them, just be careful to change them consistently in both the JavaScript and the HTML so they still match.

Maria Te
Maria Te
8,517 Points

Do you want the link to the snapshot or the actual link the the workspace? If it's the workspace then if I give it to you, will to damage it?

Steven Parker
Steven Parker
173,784 Points

You can't share a direct URL to your workspace, it's temporary and only exists while you are using it.

But you can use the snapshot function in the workspace and provide the link to that.

Maria Te
Maria Te
8,517 Points

Oh right okay. Here's the link: Snapshot To Workspace

Maria Te
Maria Te
8,517 Points

Oh, right. Thanks so much. Guess I wasn't so careful. I'll mark you best answer if you'd like!