Skip to content

Instantly share code, notes, and snippets.

@thanapongp
Created October 23, 2019 08:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thanapongp/292b3c0ce8026402658169f773cdd75f to your computer and use it in GitHub Desktop.
Save thanapongp/292b3c0ce8026402658169f773cdd75f to your computer and use it in GitHub Desktop.
performEdit method
performEdit(item, editInput) {
const itemNameEl = item.getElementsByClassName('item-name')[0];
const editButtonEl = item.getElementsByClassName('edit-button')[0];
if (editInput.value.trim().length !== 0) {
itemNameEl.innerHTML = editInput.value.trim();
}
editInput.remove();
itemNameEl.classList.remove('hidden');
editButtonEl.classList.remove('hidden');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment