title: Error in response to storage.get: TypeError: Cannot read property 'dataset' of null
body: <p>Within my <em>options.html</em> file, I am setting a value in <code>chrome.storage.local</code>, but I can't <code>get()</code> the value when I try to, from within my <em>popup.html</em>. It's like it can't get it, because it is on a "different" site (the popup site). This is what I get: </p>
  
  <pre><code>Error in response to storage.get:
  TypeError: Cannot read property 'dataset' of null
      at Object.callback (chrome-extension://fcbadpjebgjnohhcihmkopdbnbjjmnod/load_id_to_popup.js:8:37)
      at chrome-extension://fcbadpjebgjnohhcihmkopdbnbjjmnod/load_id_to_popup.js:2:22
  </code></pre>
  
  <p>It's not a typo, right? Please tell me it is, that would be lovely easy to fix.</p>
  
  <p>(<a href="https://stackoverflow.com/questions/41038011/extension-chrome-storage-set/41056054#41056054">First post (solved)</a>)</p>
  
  <p><strong>options.html</strong></p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
    &lt;head&gt;
     &lt;title&gt;Teamsepak 3 Server Viewer Options&lt;/title&gt;
    &lt;style&gt;
      body: { padding: 10px; }
    &lt;/style&gt;
  
      &lt;title&gt;&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;p&gt;ENTER YOUR ID FROM tsindex.com BELOW&lt;/p&gt;
        &lt;form&gt;
            &lt;input id="ts_id_js_html" type="text" value="128856"&gt;&lt;/input&gt;
            &lt;br&gt;
            &lt;br&gt;
            &lt;button id="execButton"&gt;Save/Load&lt;/button&gt;
        &lt;/form&gt; 
      &lt;div id="initialize"&gt;
        &lt;div id="initialize_id"&gt;&lt;/div&gt;
        &lt;div id="initialize_if"&gt;&lt;/div&gt;
        &lt;div id="initialize_else"&gt;&lt;/div&gt;
      &lt;/div&gt;
  
  &lt;script src="initialize_id.js"&gt;&lt;/script&gt;
  &lt;script src="options.js"&gt;&lt;/script&gt;
  &lt;script src="load_id.js"&gt;&lt;/script&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>options.js</strong></p>
  
  <pre class="lang-js prettyprint-override"><code>//Javascript Document
  document.getElementById("execButton").addEventListener("click", store); //adds button functionality to button (id=execButton)
  
      function store(){
      var input_id = document.getElementById("ts_id_js_html").value;
  
      chrome.storage.local.set({"ts_id_js": input_id}, function (obj) {
      chrome.storage.local.get("ts_id_js", function (obj) {
          console.log("ts_id_js INSIDE func. test (is this your ID?):" + obj.ts_id_js);
     });
  
  });
  }
  </code></pre>
  
  <p><strong>load_id_to_popup.js</strong> here seems to be the problem, this can't GET the desired value.</p>
  
  <pre class="lang-js prettyprint-override"><code>//Javascript Document
  chrome.storage.local.get("ts_id_js", function (obj) {
  
  if (obj.ts_id_js == undefined || null){
      document.getElementById('input_id').dataset.serverid = 128856;
      console.log("Default ID (128856) loaded to popup.html.");
  } else {
      document.getElementById('input_id').dataset.serverid = obj.ts_id_js;
      console.log("Stored ID loaded to popup.html.");
  }
  
  });
  </code></pre>
  
  <p><strong>popup.html</strong></p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;script src="jquery-2.2.0.min.js"&gt;&lt;/script&gt; 
    &lt;/head&gt;
    &lt;body&gt;
      &lt;div class="ts3index-viewer" id="input_id" data-serverid="128856" data-style="clientc=030B80"&gt;&lt;a href="http://ts3index.com/?page=server&amp;id="&gt;TS3index.com&lt;/a&gt;&lt;/div&gt;
      &lt;script src="load_id_to_popup.js"&gt;&lt;/script&gt;
      &lt;script src="popup.js"&gt;&lt;/script&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>manifest.json</strong></p>
  
  <pre class="lang-json prettyprint-override"><code>{
    "manifest_version": 3,
  
    "name": "Teamspeak - xxxxx Community",
    "description": "This extension will show Users that are Online on our Teamspeaks Server.",
    "version": "1.4.1",
    "options_page": "options.html",
  
    "browser_action": {
     "default_icon": "ts3.png",
     "default_popup": "popup.html"
    },
    "permissions": [
     "activeTab",
     "storage"
    ],
  
    "background": {
      "scripts":["popup.js", "load_id.js", "onclick_button.js", "load_id_to_popup.js", "initialize_id.js", "jquery-2.2.0.min.js", "options.js"]
    },
  
    "content_scripts": [
      {
        "matches": [
          "&lt;all_urls&gt;"
        ],
        "js": ["popup.js", "load_id.js", "onclick_button.js", "load_id_to_popup.js", "initialize_id.js", "options.js", "jquery-2.2.0.min.js"]
      }
    ]
  }
  </code></pre>