Skip to content

Instantly share code, notes, and snippets.

@thanapongp
Last active October 23, 2019 04:56
Show Gist options
  • Save thanapongp/994268c3e50e51fdb1b315e0f18ab77b to your computer and use it in GitHub Desktop.
Save thanapongp/994268c3e50e51fdb1b315e0f18ab77b to your computer and use it in GitHub Desktop.
app.js with new editItem method
addNewItem(itemName) {
//...
const item = htmlToElement(`
...
<button class="edit-button">
<svg class="stroke-current text-gray-600 h-4" viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path>
<path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path>
</svg>
</button>
...
`);
item.getElementsByClassName('edit-button')[0].addEventListener('click', () => this.editItem(item, itemName));
}
editItem(item, oldItemName) {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment