title: How to store <div> elements to localStorage?
body: <p>I´m trying to set an array of items(divs) to Local Storage for when the page reloads these elements being shown in the Ui. The function checks if there is an array already stored with that name, and if so, the local storage must clean this item and then set the array updated whit these items that were added in another part of the code. But when I see what local storage is returning after I set this array I find an array with empty objects with the same length that would must have, and in this same function before I set the array is correct with all the items there.
  What am I missing?</p>
  <pre><code>function setToLocalStorage(){
    console.log(items); //the is array is there with all items
  
    if(!!localStorage.getItem(&quot;items&quot;)){
      localStorage.removeItem(&quot;items&quot;);
    }
  
    localStorage.setItem(&quot;items&quot;,JSON.stringify(items));
  </code></pre>
  <p>}</p>
  <pre><code>function getDataFromLocalStorage(){
    let elements=JSON.parse(localStorage.getItem('items'));
    console.log(elements); //I get an array with empty objects with the same length of the first
  </code></pre>
  <p>}</p>