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 trialAF Content
21,460 PointsWhy isnt the checkbox working for a user generated task
It looks like I am able to add a task to to incompletedTaskHolder correctly, but when I check the checkbox for the task that I added nothing is happening. In the html, the type "checkbox" seems to be correct, and when I check the original checkboxes, the list items are moving from incompleted task to completed task sections correct.
my code for my createNewTaskElement function is below
//New Task List Item
var createNewTaskElement = function(taskString){
//create list item
var listItem = document.createElement('li');
var checkBox = document.createElement('input');
var label = document.createElement('label');
var editInput = document.createElement('input');
var editButton = document.createElement('button');
var deleteButton = document.createElement('button');
//each elements, needs modifying
checkBox.type = "checkbox";
editInput.type = "text";
editButton.innerText = "Edit";
editButton.className = "edit";
deleteButton.innerText = "Delete";
deleteButton.className = "delete";
label.innerText = taskString;
//each elements, needs appended
listItem.appendChild(checkBox);
listItem.appendChild(label);
listItem.appendChild(editInput);
listItem.appendChild(editButton);
listItem.appendChild(deleteButton);
return listItem;
}
Karen Freeman-Smith
29,248 PointsKaren Freeman-Smith
29,248 PointsYou don't have any code here for catching the "change" when the checkbox is clicked. It was added later on in the course, so that may not be a problem yet...but something that is solved in the next video or two.