Created
July 5, 2019 04:05
-
-
Save sergey-shambir/0de74fee9fa8b4972590c89df34174e3 to your computer and use it in GitHub Desktop.
To-Do App JS, layer 4
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() { | |
const saveButton = document.querySelector("button.save"); | |
const clearButton = document.querySelector("button.clear"); | |
const showTipsButton = document.querySelector("button.showTips"); | |
const closeTipsButton = document.querySelector("a.closeTips"); | |
const overlay = document.querySelector("#overlay"); | |
// .. | |
saveButton.addEventListener("click", () => { | |
localStorage.setItem("todos", ul.innerHTML); | |
}); | |
clearButton.addEventListener("click", () => { | |
ul.innerHTML = ""; | |
localStorage.removeItem('todos', ul.innerHTML); | |
}); | |
showTipsButton.addEventListener("click", () => { | |
overlay.style.height = "100%"; | |
}); | |
closeTipsButton.addEventListener("click", () => { | |
overlay.style.height = "0"; | |
}); | |
} | |
document.addEventListener("DOMContentLoaded", onPageLoaded); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment