错误“未捕获的参考错误:未定义$". [英] Error "Uncaught ReferenceError: $ is not defined"
本文介绍了错误“未捕获的参考错误:未定义$".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我开始研究"javascript".
I began to study the "javascript".
HTML源代码中的
<!Doctype html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<button id="test_button">Test</button>
<p id="test">Hello World</p>
<!-- script -->
<script src="test.js"></script>
</body>
</html>
在javascript源代码中
in javascript source code
"use strict";
$(function() {
document.getElementById("test_button").onclick = test_click;
function test_click() {
document.getElementById("test").innerHTML = "HI";
}
});
哪里出问题了?
推荐答案
您需要包含jQuery.尝试将其添加到您的<head>
:
You need to include jQuery. Try adding this to your <head>
:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
这篇关于错误“未捕获的参考错误:未定义$".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文