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 trialMaxwell DeMers
6,853 PointsUncaught Reference Error in Console
I was following the video, and went to the console to check that my variables were selecting the correct IDs by using document.getElementById("id"). However, when I go to the console(Chrome), I get an Uncaught Reference Error. I rebuilt the variable in the console with the document.get method, and worked fine. See code below.
var taskInput = document.getElementById("new-task"); //new-task
var addButton = document.getElementsByTagName("button")[0]; //first button
var incompleteTaskHolder = document.getElementById("incomplete-tasks"); //incomplete tasks
var completedTasksHolder = document.getElementById("completed-tasks"); //completed tasks
I think it may be something simple that I am not doing, but I don't see it. Please help.
Mod Note - Added backticks and language for formatting and syntax highlighting.
Maxwell DeMers
6,853 PointsHey thanks rydavim. I didn't know about the workspace snapshot. See link below for snapshot.
2 Answers
Enrique Ortega
7,966 PointsI know it might seem odd, but make sure that you hit refresh on the app preview itself. I was having the same issue and that fixed it for me. I have noticed that sometimes hitting the preview from Workspace doesn't always refresh the page on the app. Not sure if it's a caching problem or not, but sure seems like it.
I hope that this helps.
Maxwell DeMers
6,853 PointsLooks like that did it! Thanks Enrique.
rydavim
18,814 PointsI didn't get a reference error, but it looks like you've got an extra set of closing curly braces after one the functions - taskCompleted - on about line 45. Should be good to go if you remove one. Happy coding!
var taskCompleted = function(){} // You end the function block here...
} // ...and again down here.
rydavim
18,814 Pointsrydavim
18,814 PointsI don't see anything obviously wrong with the lines you've posted. It would be helpful if you could post a workspace snapshot of your full code, and we'll see if we can't figure out what the problem is.