我正在尝试在Chrome应用中使用JQuery。但是,当我在加载后尝试使用JQuery时,它不起作用。它应该只使用标记test
隐藏元素。我不知道这是否是我加载JQuery js文件的方式有问题,或者如果Chrome应用程序不允许这样做。
app.js:
$(document).ready(function() {
$("#test").hide();
});
HTML:
<!DOCTYPE html>
<html>
<head>
<title>ImageRetriever</title>
<link rel="stylesheet" href="styles.css">
<!-- This is where I'm loading the JQuery js file from -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
</head>
<body>
<script src="app.js"></script>
<h1 id="test">Hey</h1>
</body>
</html>
清单文件:
{
"manifest_version": 2,
"name": "ImageRetriever",
"short_name": "ImageRetriever",
"description": "",
"version": "0.0.1",
"minimum_chrome_version": "38",
"icons": {
"16": "assets/icon_16.png",
"128": "assets/icon_128.png"
},
"permissions": [
"contextMenus",
"alarms",
"storage",
"webview",
"<all_urls>"
],
"app": {
"background": {
"scripts": ["background.js"]
}
}
}