【发布时间】:2018-01-26 08:25:42
【问题描述】:
我有这个错误信息 ReferenceError: $ is not defined when using vscode built-in debugger node.js Here is the html
<!doctype html>
<html lang="en">
<head>
<title>14. Getting Started with jQuery</title>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
<body>
<script type="text/javascript" src="js/app.js"></script>
</body>
</html>
这里是 app.js
$(function() {
// start up code goes here
alert("this works!");
});
我在警告行设置了一个断点并在 vscode 中运行调试(node.js)。它停在 $(function() { - app.js 的第一行,错误消息是 ReferenceError: $ is not defined。好像 jQuery 没有加载。
我试过了
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
和
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
但它们都不起作用。请帮忙。
【问题讨论】:
-
jQuery 实际上没有加载,但这是非常基本的。不知道你为什么说node.js,就是一个简单的HTML页面,不能直接打开控制台检查一下错误吗?
标签: jquery visual-studio-code referenceerror