jQuery not working in chrome extension popup jQuery not working in chrome extension popup google-chrome google-chrome

jQuery not working in chrome extension popup


You need to:

  1. Learn to debug extension popups. It will show you an informative error.

  2. Said error will refer to Content Security Policy. So you need to read about extensions' CSP.

  3. After you read the above documentation, the first problem you need to fix is trying to use a remote script. This is possible, but for something like jQuery it's best to download a copy of it, add it to extension's folder and include it as a local file:

    <!-- refers to extension's own folder --><script src="jquery.min.js"></script>
  4. Second, you need to collect your own scripts inside a file and include it like that as well; inline code is not allowed in any form, and content scripts do not apply for extension pages.


Also make sure to include jQuery.min.js before popup.js. I made this silly mistake, was loading popup.js before jQuery.min.js and it doesn't work that way. So always load jQuery.min.js first.