title: If localstorage empty do nothing. If not, do something
body: <p>Would I be able to create a function that automatically runs when something is put into localstorage?</p>
  
  <p>I tried to come up with something myself but it doesn't seem to work.</p>
  
  <pre><code>function () {
      if (localStorage.value == ""){
          //do nothing
      }
      else {
          document.getElementById("test").innerHTML = "" + (localStorage.getItem("server")) + ""  ;
      }
  }
  </code></pre>
  
  <p><strong>Edit:</strong> This bit of code works, but it doesn't update itself, so if I enter a new value into localstorage, this code won't pick it up and will display the old value still.</p>
  
  <pre><code>if (localStorage.length == 0){   
      document.getElementById("test").innerHTML = "Please go back and enter your name.";
  }
  else {
      document.getElementById("test").innerHTML = "" + (localStorage.getItem("server")) + ""  ;
  }
  </code></pre>