【发布时间】:2014-10-17 14:06:33
【问题描述】:
<html>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<script type="text/javascript">
$(document).ready(function () {
alert("Test");
});
</script>
<script type="text/javascript" src="js/libs/jquery-2.1.1.min.js"></script>
</html>
如果我在 jquery 脚本之后调用 $(document).ready(function (){ }); 函数。然后它正在工作。但在上述情况下,它无法正常工作,并且 Firefox 控制台正在调试
ReferenceError: $ is not defined
火狐版本 =31.0
请问有人可以帮助解决这个问题吗?
谢谢,
【问题讨论】:
-
为什么要在加载jquery之前运行jquery?
-
我读到了 $(document).ready(function (){ });将在加载 DOM 后调用。所以它应该工作。为什么不工作?
-
推荐阅读jQuery教程:learn.jquery.com/about-jquery/how-jquery-works
标签: javascript jquery html dom