title: How to save local data in Chrome Extension
body: <p>I'm having a problem of chrome storage.<br>
  I set the permission correctly in manifest.json.<br>
  I think my code has a problem. (HTML File is fine too. There is only input tag.<br>
  Is there someone who can tell me the problem?<br>
  Thank you~<br></p>
  
  <pre><code>chrome.storage.sync.get(function (data) {
      var input = document.querySelector('input');
      if(data.count == 1){
          input.value = data.getData;
      }
  });
  
  
  
  var addBtn = document.getElementById('addBtn');
  addBtn.addEventListener('click', () =&gt; {
      var input = document.querySelector('input');
      chrome.tabs.getSelected(null, function(tab){
          input.value = tab.url;
          var getData = input.value;
          chrome.storage.sync.set({
              'getData' : getData,
              'count' : 1
          });
      });
  });
  </code></pre>
  
  <p>If, I click the btn, I want to get the url data in input=text form.<br>
  However, before clicking btn, there is already url data in input.<br>
  The thing that I want to do is <br><br>
  1. click btn and it saves url in input form.<br>
  2. If I delete the data in input form, it remains data like I did. <br>(I mean input form maintains empty data if I delete the value.)<br><br></p>
  
  <p>Conclusion : click! get data locally! <br>
  If you don't understand my question, please comment.</p>