title: jquery & html5 text box save / load from local storage
body: <p>Looking to store my text box values to local storage, have them called up upon when page loads, but if no values are typed in (ie. first time app is loaded) I get an error on saying </p>
  
  <pre><code> TypeError: pName is null
   [Break On This Error]  
  
   if(pName.length&gt;0){
  </code></pre>
  
  <p>JS:</p>
  
  <pre><code>$('#form').on("pageinit", function() {
      $('#saveButton').click(function() {
          localStorage.setItem("Name", $('#Name').val());
      });
  });
  
  
  $('#form').on("pageinit", function() {
  var pName = localStorage.getItem("Name");    
  if(pName.length&gt;0){
  $('#Name').val(pName);
  } 
  });
  </code></pre>
  
  <p>I tried adding this, but it doesn't appear to actually load Enter Name if the value was below 0....</p>
  
  <pre><code>$('#form').on("pageinit", function() {
   var pName = localStorage.getItem("Name");
  
     if(pName.length&gt;0){
          $('#Name').val(pName);
       } else {
          $('#Name').val("Enter name.");
       }
       });
  </code></pre>