我是 jQuery 的新手,所以我需要一些帮助。我从 jquery.com 下载了最新版本的 jQuery。
我将其保存为文本文件 jquery.js
。然后我将我的 html 代码和 jquery.js
保存在同一个文件夹中。
当我运行我的代码时,我的 jQuery 代码功能不起作用,但是当我在我的代码中使用来自 Google 的 jQuery 时,它运行得非常好
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
所以请帮我解决我的问题。
我的代码如下:
<!DOCTYPE html>
<html>
<head>
<script src="javascript/jquerymin.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("p").hide("slow",function(){
alert("The paragraph is now hidden");
});
});
});
</script>
</head>
<body>
<button>Hide</button>
<p>This is a paragraph with little content.</p>
</body>
</html>
最佳答案
我猜你在加载 javascript/jquerymin.js
时遇到了 404
错误。
I save this as a text file as jquery.js. Then I keep my html code & jquery.js in same folder
这意味着你必须改变这个:
<script src="javascript/jquerymin.js"></script>
进入这个:
<script src="jquery.js"></script>
您的应用程序文件将如下所示:
site-root
├── index.html
└── jquery.js
关于javascript - jQuery 不在我的浏览器中运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20726535/