Access DOM from popup.js | Chrome Extension
<p>I'm trying to make a Chrome Extension that will take some of the contents of a page (The inner HTML of a <code>&lt;span&gt;</code> with <code>id="productTitile"</code>) I then would need to take that value and put it into a field in my popup.html.</p>

<p>I have tried this:</p>

<pre><code>document.getElementById('input_87').value = chrome.tabs.executeScript({
    code: 'document.getElementById("productTitle").innerHTML'
});
</code></pre>

<p>But it just returns <code>undefined</code> into the field. I then ran <code>document.getElementById("productTitle").innerHTML</code> in the console in the parent page, and it gave me the expected value, but when I ran the whole code in console of the popup extension, it again returned undefined.</p>

<p>What am I doing wrong?</p>