save in localstorage

This commit is contained in:
Mahdi Dibaiee 2016-07-24 16:35:32 +04:30
parent 8d7926e55e
commit 165e39ed7e

View File

@ -27,4 +27,14 @@
</head>
<textarea></textarea>
<script>
var txt = document.querySelector('textarea');
txt.value = localStorage.getItem('text') || '';
txt.addEventListener('keydown', function(e) {
localStorage.setItem('text', txt.value);
});
</script>
</html>