title: Run Javascript in Chrome Extension -> Basic?
body: <p>I get the feeling I'm missing something very obvious, but I've been looking everywhere and can't seem to make this work. In short, I want to turn a small Javascript script into a chrome extension to make it easier to use. </p>
  
  <p>The script just reads text from a textArea, modifies the script and outputs it into a div. It works perfectly with any browser when running standalone, but doesn't seem to want to work when ran as a Chrome extension</p>
  
  <p>Here are the files (I'm basically trying to convert the example):</p>
  
  <h2>Thanks!</h2>
  
  <p>manifest.json</p>
  
  <pre><code>    {
    "manifest_version": 2,
  
    "name": "One-click Kittens",
    "description": "This extension demonstrates a 'browser action' with kittens.",
    "version": "1.0",
  
    "browser_action": {
      "default_icon": "icon.png",
      "default_popup": "popup.html"
    },
    "permissions": [
      "https://secure.flickr.com/"
    ]
  }
  </code></pre>
  
  <p>popup.html</p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;title&gt;Getting Started Extension's Popup&lt;/title&gt;
      &lt;style&gt;
        body {
          min-width: 357px;
          overflow-x: hidden;
        }
  
        img {
          margin: 5px;
          border: 2px solid black;
          vertical-align: middle;
          width: 75px;
          height: 75px;
        }
      &lt;/style&gt;
  
      &lt;!--
        - JavaScript and HTML must be in separate files: see our Content Security
        - Policy documentation[1] for details and explanation.
        -
        - [1]: http://developer.chrome.com/extensions/contentSecurityPolicy.html
       --&gt;
      &lt;script src="popup.js"&gt;&lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
  
      &lt;textarea id="source"&gt;Text Entry.&lt;/textarea&gt;
      &lt;button onclick="main()" id="buttons"&gt;Generate&lt;/button&gt;
  
      &lt;div id="result"&gt;       
      &lt;/div&gt;
  
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>popup.js</p>
  
  <pre><code>function main() {
      var source = document.getElementById('source').value;
      document.getElementById("result").innerHTML = source;
  }
  </code></pre>