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 trial

JavaScript Interactive Web Pages with JavaScript Traversing and Manipulating the DOM with JavaScript Perfect

John Girard
John Girard
6,349 Points

adds a blank item with edit/delete buttons but no text after typing in the add item box.

snapshot of workspace: https://w.trhou.se/ullwxrvvbo

won't work in chrome or firefox

1 Answer

Kris Phelps
Kris Phelps
7,609 Points

I see in your code where you pass the value of the taskInput element to your createNewTaskElement function:

var listItem = createNewTaskElement(taskInput.value);

But I don't see where taskString is referenced in that function:

//New Task List Item
var createNewTaskElement = function(taskString) {
  //Create List Item
  var listItem = document.createElement("li");

//input checkbox
  var checkBox = document.createElement("input"); //checkbox

  //label
  var label = document.createElement("label");

  //input (text)
  var editInput = document.createElement("input"); //text

  //button.edit
  var editButton = document.createElement("button");

  //button.deletes
  var deleteButton = document.createElement("button");

  //Each elements needs modifying
  checkBox.type = "checkbox";
  editInput.type = "text";

  editButton.textContent = "Edit";
  editButton.className = "edit";
  deleteButton.textContent = "Delete";
  deleteButton.className = "delete";


  //Each element needs appending
  listItem.appendChild(checkBox);
  listItem.appendChild(label);
  listItem.appendChild(editInput);
  listItem.appendChild(editButton);
  listItem.appendChild(deleteButton);


  return listItem;
}

I hope this helps :-)