Skip to content

Instantly share code, notes, and snippets.

@sergey-shambir
Created July 5, 2019 04:03
Show Gist options
  • Save sergey-shambir/14ffa9d74a4f17b3889cfcd359dc562c to your computer and use it in GitHub Desktop.
Save sergey-shambir/14ffa9d74a4f17b3889cfcd359dc562c to your computer and use it in GitHub Desktop.
To-Do App JS, layer 2
function onPageLoaded() {
// ...
function createTodo() {
// ...
listenDeleteTodo(deleteBtn);
}
function listenDeleteTodo(element) {
element.addEventListener("click", (event) => {
element.parentElement.remove();
event.stopPropagation();
});
}
// ...
}
document.addEventListener("DOMContentLoaded", onPageLoaded);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment