I have been trying to find a way to not have to refresh to see new and updated data from localStorage. I have a text box currently, with a submit button on the side. Once you type something into the text box and click "submit", the text you put gets saved into localStorage. I then displayed it below the text box. All of this works fine, but the only problem is that the data in localStorage doesn't get displayed right away, you have to reload the page. I would like the data to constantly update, so you don't have to reload the page each time you want to see data from localStorage. This is what I have so far:
//"saves" is the id I assigned to the div that stores the saves.
document.getElementById('saves').innerHTML = localStorage.getItem('item-array-HTML-program');
//save() gets called when the submit button is clicked.
function save() {
//data is an empty array, and the variable "var" is the textboxes.value
var data = [], val = document.getElementById('textbox').value;
//the data that's already been stored in the HTML program key gets pushed into the empty array
"data"
data.push(localStorage.getItem('item-array-HTML-program'));
//the text in the text box gets pushed into the array "data"
data.push(val);
//the array "data" gets set into localStorage.
localStorage.setItem('item-array-HTML-program', data);
}