Skip to content

Commit

Permalink
Update blank.html
Browse files Browse the repository at this point in the history
  • Loading branch information
nitrogenxx authored Jul 29, 2024
1 parent 95d89d8 commit 2a9abf6
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion blank.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,18 @@ <h1>Live Text Editor</h1>
const editor = document.getElementById('editor');
const output = document.getElementById('output');

// Load saved content from local storage
const savedContent = localStorage.getItem('editorContent');
if (savedContent) {
editor.value = savedContent;
output.innerHTML = savedContent;
}

editor.addEventListener('input', function() {
output.innerHTML = editor.value;
const content = editor.value;
output.innerHTML = content;
// Save content to local storage
localStorage.setItem('editorContent', content);
});
</script>
</body>
Expand Down

0 comments on commit 2a9abf6

Please sign in to comment.