Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement