Calling CONTENT_SCRIPT JS From BROWSER_ACTION Popup HTML
Posted
by Aristotle
on Stack Overflow
See other posts from Stack Overflow
or by Aristotle
Published on 2010-05-05T00:25:16Z
Indexed on
2010/05/05
0:28 UTC
Read the original article
Hit count: 508
google-chrome-extension
|jQuery
I'm working on a Google Chrome Extension and would like to get an HTML from within my popup HTML to call functions within my loaded javascript file. My manifest follows:
{
"name": "Extension",
"version": "1.0",
"description": "Extension",
"browser_action": {
"default_icon": "icon.png",
"default_title": "Ext",
"popup": "popup.html"
},
"content_scripts": [{
"matches": ["http://*/*"],
"css": ["ext.css"],
"js": ["jquery.js","scripts.js"]
}],
"permissions": [
"http://*/*"
]
}
As you can see I'm loading in a local copy of jQuery, along with another javascript file for my own personal logic. My popup document looks like this:
<select id="values">
<option>Foo</option>
<option>Bar</option>
</select>
And the contents of my scripts.js
file follow:
$(function(){
$("#values").change(function(){
alert("Foo");
});
});
This isn't doing what I expect though - alerting "Foo" anytime I change a value in my popup HTML. How can I get these two files to communicate with eachother? Or can they at all?
© Stack Overflow or respective owner