【发布时间】:2015-02-13 00:11:24
【问题描述】:
我有以下代码,每当我用 HTML 加载它时,控制台都会在加载后立即给出错误。
Uncaught ReferenceError: $ is not defined
我的脚本链接到 HTML 文件,如下所示:<head> 中的 <script src="src-animation.js"></script>。
这是我的 jQuery:
$(document).ready(function(){
$('.play').click(function() {
$(this).fadeOut('slow');
$(this).append("<h1>Now loading...</h1>");
});
$('.not-rdy').click(function(){
alert("This chapter isn't done yet.\nComing soon!");
$(this).fadeOut('fast');
});
$('#updateCHK').click(function() {
alert("Server is temporarily unavailable.\nTry again later.");
});
});
我做错了什么?
【问题讨论】:
-
要么你没有在
src-animation.js之前加载jQuery,要么它处于noConflict模式。 -
@AlexanderO'Mara “在
src-animation.js之前加载jQuery”是什么意思?
标签: jquery referenceerror