Skip to content

Instantly share code, notes, and snippets.

@sergey-shambir
Created July 5, 2019 04:08
Show Gist options
  • Save sergey-shambir/ff39a6fc11f989c29575e5868c82470d to your computer and use it in GitHub Desktop.
Save sergey-shambir/ff39a6fc11f989c29575e5868c82470d to your computer and use it in GitHub Desktop.
To-Do App JS, layer 5
function onPageLoaded() {
// ...
function listenDeleteTodo(element) {
// ...
}
function loadTodos() {
const data = localStorage.getItem("todos");
if (data) {
ul.innerHTML = data;
}
const deleteButtons = document.querySelectorAll("span.todo-trash");
for (const button of deleteButtons) {
listenDeleteTodo(button);
}
}
// ...
loadTodos();
}
document.addEventListener("DOMContentLoaded", onPageLoaded);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment