Skip to content

Commit

Permalink
saved name to local storage
Browse files Browse the repository at this point in the history
  • Loading branch information
met18001 committed Apr 22, 2020
1 parent 85e5213 commit 27b7496
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion final_project/js/this.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,22 @@ if (curHr < 12) {
document.getElementById('morning').innerText ='afternoon'
} else {
document.getElementById('morning').innerText ='night'
}
}




let areaText = document.getElementById("name");

const saveLocally = function() {
let text = areaText.innerHTML;
localStorage.setItem('siteData', text);
}

const retrieveSavedText = function() {
var text = localStorage.getItem('siteData');
areaText.innerHTML = text;
}

document.addEventListener('keyup', saveLocally);
retrieveSavedText();

0 comments on commit 27b7496

Please sign in to comment.