我正在尝试执行 JavaScript 函数。每次函数进入 Ajax block 时我都会收到错误消息:
$ is not defined
我该如何解决这个问题?我正在编写一个 Google Chrome 插件
,但在我的 .js 文件中出现了这个错误:
目前只有上面的函数和它在文件中的调用者:
// Calls get_pw function
document.addEventListener('DOMContentLoaded', function(){
document.getElementById('submit').addEventListener('click', get_pw)
})
非常感谢
最佳答案
从 https://code.jquery.com/jquery-3.3.1.min.js 下载 jQuery .将其包含在文档的 head 标记中,并在加载文档时调用 get_pw()。
关于javascript - $ 未定义 - 外部 js 文件中的 Ajax 调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49146865/