为什么jQuery代码不起作用?
问题描述:
我正在学习jQuery并使用Visual Studio 2013作为编辑器。这里是我的html代码为什么jQuery代码不起作用?
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="jquery-3.1.0.js"></script>
<script src="jquery-3.1.0.min.js"></script>
</head>
<body>
<script type="text/javascript">
$(window).load(function() {
alert("Window Loaded");
});
$(document).ready(function() {
alert("Document Ready");
});
</script>
</body>
</html>
但是,当页面在浏览器中加载此代码不提醒我。我在Chrome浏览器中试过。
答
只包括两种jquery-3.1.0.js
或j query-3.1.0.min.js
你不能同时拥有包括在头
+0
它仍然无法正常工作。 '
' –+0
检查您的浏览器的网络选项卡。看看你是否为jquey .js文件获得404。如果是这种情况,则需要修复.js文件的位置 –
+0
谢谢,现在它正在工作。我搞砸了jquery-3.1.0.js和jquery-3.1.0.min.js文件。 –
你只需要要么最小化或unminimised jQuery库,而不是两个。 –