SHARE
TWEET

Untitled

a guest Mar 26th, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. window.addItem = function() {
  2.   var list = document.getElementById("list");
  3.   var listItem = document.createElement("li");
  4.   var input = document.createElement("input");
  5.  
  6.   input.addEventListener('keydown', event => {
  7.     if(event.key === 'Enter') {
  8.       listItem.textContent = event.target.value;
  9.     }
  10.   })
  11.  
  12.   listItem.appendChild(input);
  13.   list.appendChild(listItem);
  14.  
  15.   var iconsContainer = document.createElement("span");
  16.   listItem.appendChild(iconsContainer);
  17.  
  18.   var editIcon = document.createElement("i");
  19.   editIcon.classList.add('fas', 'fa-edit');
  20.   iconsContainer.appendChild(editIcon);
  21.  
  22.   var addIcon = document.createElement("i");
  23.   addIcon.classList.add('fas', 'fa-plus');
  24.   iconsContainer.appendChild(addIcon);
  25.  
  26.   var deleteIcon = document.createElement("i");
  27.   deleteIcon.classList.add('fas', 'fa-trash-alt');
  28.   iconsContainer.appendChild(deleteIcon);
  29.  
  30.   var completeIcon = document.createElement("i");
  31.   completeIcon.classList.add('fas', 'fa-check');
  32.   iconsContainer.appendChild(completeIcon);
  33. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top