Advertisement
PadmaJS

Untitled

Jul 16th, 2020
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. document.getElementById("addItem").onclick = () => {
  2. var todoInput = document.getElementById("todo-input");
  3. var itemList = document.getElementById("item-list");
  4. var newItem = document.createElement('li');
  5. var doneButton = document.createElement('button');
  6. newItem.textContent = todoInput.value;
  7. itemList.appendChild(newItem);
  8. doneButton.className = "done";
  9. doneButton.onclick = () => {
  10. this.parentNode.remove();
  11. };
  12. doneButton.textContent = "Done";
  13. newItem.appendChild(doneButton);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement