add to local storage and load dom elements from it javascript code example Example: how to add variable to local storage in javascript localStorage.setItem('key', 'value')