我目前正在开发Chrome扩展程序,但我似乎无法执行任何Javascript。
$(document).ready(function () {
$("#overlay").hide();
});
在这个例子中,我试图隐藏一个id为“overlay”的div,但它似乎不起作用。存储在外部文件(popup.js)
中清单:
{
"name": "Test",
"version": "0.0.1",
"manifest_version": 2,
"description": "",
"offline_enabled": true,
"background": {
"scripts": [
"js/background.js"
]
},
"icons": { "16": "android-16.png",
"48": "android-48.png",
"128": "android-128.png"
},
"browser_action": {
"default_icon" : "android-128.png",
"default_title": "",
"default_popup": "index.html"
},
"permissions": [
"background", "unlimitedStorage", "tabs"
],
"web_accessible_resources": [
"index.html","js/popup.js"
]
}
位于正文结束标记之前的HTML链接:
<script src="js/background.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="js/popup.js"></script>