Reputation: 7278
I am trying to make a Chrome extension. My goal is to do the following:
My code looks really simple but I am not sure where I am missing. Will the jQuery not work this way in Chrome extension? Is there any equivalent code in plain JavaScript?
manifest.json
{
"name": "Handle a button click",
"version": "1.1",
"background": { "scripts": ["background.js"] },
"permissions": [
"tabs"
],
"browser_action": {
"name": "click to handle"
},
"content_scripts": [
{
"matches": ["<all_urls>"],
"js": ["jquery-1.9.0.min.js"]
}
],
"manifest_version": 2
}
background.js
$(document).ready(function(){
$("#my_submit").click(function(){
alert("yo");
});
}
UPDATE AFter debugging for background.js I am seeing:
"Uncaught ReferenceError: $ is not defined"
jQuery file is not getting included? or why?
Upvotes: 1
Views: 738