Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMaria Te
8,521 PointsWhat'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?
4 Answers
Steven Parker
231,275 PointsThere'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
8,521 PointsBy 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
231,275 PointsIt'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
8,521 PointsDo 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
231,275 PointsYou 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
8,521 PointsOh right okay. Here's the link: Snapshot To Workspace
Maria Te
8,521 PointsOh, right. Thanks so much. Guess I wasn't so careful. I'll mark you best answer if you'd like!
Steven Parker
231,275 PointsSteven Parker
231,275 PointsYou 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.