我正在尝试将以下功能添加到chrome扩展程序中:
$( function() {
var availableTags = [
"ActionScript",
"JavaScript",
"Lisp",
"Perl",
"PHP",
"Python",
"Ruby",
"Scala",
"Scheme"
];
$( "#other" ).autocomplete( {
source: availableTags,
minLength: 0
})
.focus(function() {
$(this).autocomplete('search', $(this).val())
})
;
} );
但是我不断收到错误:
counterstring.js:7 Uncaught (in promise) ReferenceError: $ is not defined
at show_options (VM182 counterstring.js:7)
at VM182 counterstring.js:81
at Array.forEach (<anonymous>)
at VM182 counterstring.js:78
我已经下载了:
jquery-3.5.1.min.js
From the site: https://code.jquery.com/jquery/
并将清单文件和HTML代码添加为:
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>jQuery UI Autocomplete - Default functionality</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="/resources/demos/style.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script src="js/jquery-3.5.1.min.js"></script>
<script>
</script>
</head>
<body>
和
"background": {
"persistent": true,
"scripts": ["js/background.js","js/jquery-3.5.1.min.js"],
"matches": [ "http://*/*", "https://*/*"]
},
但我不断收到同样的错误