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 trialJonas Laberg
2,365 PointsInteractive web pages with javascript: chapter 'Perform Selecting Elements': Getting error 'taskInput is not defined'
As it says above. My code is exactly the same as in the vid, but when I type taskInput
in the console (Chrome, OS X, both latest) I get a
VM3335:1 Uncaught ReferenceError: taskInput is not defined(…)
I tried document.getElementById("new-task");
and that gets me what I want.
Halp!
Jonas Laberg
2,365 PointsNot sure what you mean by context, but I got the code to work (w/out any changes) by copypasting it into an external editor and previewing it locally. So it seems there's something going on with your editor.
Simon Coates
28,694 PointsWhen code executes on a different frame, variables can seem to disappear. Occasionally, the frame is set to an iframe or seems to run into complications with chrome plugins. You can see the page but there are multiple possible frames, and the code you run via the console is isolated from your page. If i switch contexts on the console (a plugin creates a second context accessible via the console tools), the variable (named x) is present and then disappears completely
x;
<input id="new-task" type="text">
x;
VM202:1 Uncaught ReferenceError: x is not defined(…)
Simon Coates
28,694 PointsSimon Coates
28,694 PointsI just tried it with the workspace. It worked for me. THe only thing i can think of is that you might be running the code in a different context. I get that error is I change the context (there's a drop down box) for the page using the console (see https://developer.chrome.com/devtools/docs/console#frame-selection).