Note that there are some explanatory texts on larger screens.

plurals
  1. POIncluding multiple JavaScript files in Chrome Extension's popup.html
    primarykey
    data
    text
    <p>UPDATE:</p> <blockquote> <p>The problem is caused by including an old version of jQuery(1.4.2). After I use 1.8.2 instead, the problem is just gone. But I still don't know why.</p> </blockquote> <p>I recently made a Chrome extension. Thanks to the post <a href="https://stackoverflow.com/questions/11545743/chrome-extension-insert-content-script-on-browser-action">chrome extension insert content script on browser action</a> I realized that I have to include a js file like:</p> <pre><code>&lt;script src="popup.js"&gt;&lt;/script&gt; </code></pre> <p>But later I figure out it seems you cannot include more than one file:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script src="jquery.js"&gt;&lt;/script&gt; &lt;!-- NOT LOADED --&gt; &lt;script src="popup.js"&gt;&lt;/script&gt; &lt;!-- LOADED --&gt; &lt;/head&gt; &lt;body&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>What's worse for me is that I cannot access the DOM of the popup HTML in the JS file. Like:</p> <h1>popup.html</h1> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script 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> <h1>popup.js</h1> <pre><code>/* ... jQuery Codes here ... jquery.js cannot be included via src="jquery.js" but by copy and paste its source code here it works */ $("#intro").click(function(){ alert("clicked"); // Not fireing at all }); </code></pre> <p>I am wondering what I can do to fix this. Thanks very much!</p>
    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.
 

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