Forked from Andy-set-studio/local-storage-textarea.js
Created
December 2, 2019 16:02
-
-
Save triptych/1950e462994402b42fc0df4a0802b526 to your computer and use it in GitHub Desktop.
Super basic local storage
This file contains hidden or 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