Created
July 5, 2019 04:08
-
-
Save sergey-shambir/ff39a6fc11f989c29575e5868c82470d to your computer and use it in GitHub Desktop.
To-Do App JS, layer 5
This file contains 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
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