I'm making my first Chrome extension, and ran into a problem using jQuery in a popup window. When I inspect the popup, I get an error the error: Uncaught ReferenceError: $ is not defined
though I include my local copy of jQuery in manifest.json
. I am able to console.log within popup.js, but jQuery library apparently doesn't load. I searched related questions, but couldn't identify the problem - please advise
manifest.json
{
"manifest_version":2,
"name":"extension",
"version":"0.1",
"content_scripts":[
{
"matches": [
"<all_urls>"
],
"js":["jquery-3.1.1.min.js","content.js","popup.js"]
}],
"browser_action":{
"default_icon":"icon.png",
"default_popup":"popup.html"
}
,
"background":{
"scripts":["background.js"]
}
}
popup.html
<!DOCTYPE html>
<script src="popup.js"></script>
<div>
Search RT for Movie: <input type="text" value=""><input type="submit" id="bleh">
</div>
popup.js
$(document).ready(function(){
function d(c){
console.log(c)
}
d('hi')
$('#bleh').click(function(){d('bi')})
})