Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here is a basic example of what you could use to get it working. My best guess is that it only appeared that jQuery wasn't loading because of how your <code>popup.js</code> is set up (it is trying to attach the <code>click</code> functionality before the element has loaded). I'm no JS expert, so I'm sure others will have better ideas of how to wait for the <code>DOM</code> to load, but this works as a basic test (<strong>NOTE:</strong> this uses a local version of the latest version of jQuery (1.8.2 currently), as the new content policies in manifest 2 do not allow in-line scripts):</p> <p><strong>Manifest.json</strong></p> <pre><code>{ "name": "Test Extension", "version": "1.0", "manifest_version": 2, "description": "Testing", "browser_action": { "default_icon": "my_icon.png", "default_title": "My Text Extension", "default_popup": "popup.html" }, "permissions": [ "tabs", "http://*/", "https://*/" ] } </code></pre> <p><strong>Popup.html</strong></p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script type="text/javascript" src="jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="popup.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;a id="intro" href="#" target="_blank"&gt;Intro&lt;/a&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p><strong>Popup.js</strong></p> <pre><code>/* Here we wait for the body of the popup to load before attaching our functionality */ window.onload = function() { $("#intro").click(function(){ alert("clicked"); // Should fire now }); }; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload