Created
December 2, 2019 15:24
-
-
Save Andy-set-studio/a2b65d12b33a4bc0371b6d64ad707265 to your computer and use it in GitHub Desktop.
Super basic local storage
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
const textArea = document.querySelector('textarea'); | |
const storageKey = 'text'; | |
const init = () => { | |
textArea.value = localStorage.getItem(storageKey); | |
textArea.addEventListener('input', () => { | |
localStorage.setItem(storageKey, textArea.value); | |
}); | |
} | |
init(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment