Created
          October 23, 2019 05:10 
        
      - 
      
 - 
        
Save thanapongp/89a69a26a3e463914f8c98f9a626260c to your computer and use it in GitHub Desktop.  
    editItem method
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | editItem(item, oldItemName) { | |
| const editInput = htmlToElement(` | |
| <input type="text" value="${oldItemName}" placeholder="Enter new item name" class="bg-gray-800 px-4 py-2 rounded block w-full text-gray-200 font-light"> | |
| `); | |
| const itemNameEl = item.getElementsByClassName('item-name')[0]; | |
| const editButtonEl = item.getElementsByClassName('edit-button')[0]; | |
| insertElementAfter(editInput, itemNameEl); | |
| itemNameEl.classList.add('hidden'); | |
| editButtonEl.classList.add('hidden'); | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment