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 trialAnna Steirer
6,734 PointsHaving same problem as below where the workspace is returning undefined variables. I have not tried other workspaces.
Here is my code:
I am having the same issue. Here is my code:
//Problem: user interaction doesn't provide desired results.
//Solution: Add interactivity so the user can manager daily tasks.
var taskInput = document.getElementById("new-task"); = //new-task
var addButton = document.getElementByTagName("button") [0]; = //first button
var incompleteTaskholder = document.getElementById("incomplete-tasks"); //incomplete-tasks
var completedTaskholder = document.getElementById("completed-tasks"); //completed-tasks
//Add a new task
var addTask = function() {
//When button is pressed,
//Create a new list item with the text from #new-task
//input (checkbox)
//Label
//input (text)
//button.edit
//button.delete
//each element needs to be modified and appended
}
//Edit an existing task
var editTask = function() {
//If the parent has the class .editMode
//switch from .editMode
//Make lable text become input value
//else
//Switch to .editMode
//input value becomes the label's text
//Toggle .editMode
}
//Delete an existing task
var deleteTask = function() {
//When delete button is pressed
//Remove parent list item from the ul
}
//Mark a task as complete
var taskCompleted = function() {
//When the checkbox is checked
//Append the task list item to the #completed-tasks
}
//Mark a task as incomplete
var taskIncomplete = function() {
//When the checkbox is unchecked
//Append the task list item to the #incompleted-tasks
3 Answers
Stephen Bone
12,359 PointsHi Anna
I've found a few initial problems (with the code you've posted anyway).
On lines 3 and 4 after the semi-colon there are unnecessary equals signs, these can just be deleted.
Your taskIncomplete function has no closing curly brace (possibly just missed it out when you've pasted it in here).
And lastly on line 4 the method is getElementsByTagName (note the "s" on Elements is missing on your code).
So it should be as below:
var addButton = document.getElementsByTagName("button")[0];//first button
Hope it helps!
Anna Steirer
6,734 PointsThanks, Stephen. I still can't get the console to work in Workspace but now I know it's not because of my code.
Sarah Hoopes
6,304 PointsI was having this same problem and it was driving me crazy!
The following worked for me after checking that there were no errors with my code:
I saved my workspace and refreshed the preview of my To Do list. Then I re-opened the JavaScript console and it worked just fine.
By not refreshing the preview, it wasn't applying the new code from the Workspace.