我的 jquery 无法在任何浏览器中工作,我在网络上提供了许多答案,但没有一个能帮助我......!!
这是我的代码 在索引文件中我都尝试过 (index.html)和(index.php)
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Jquery</title>
</head>
<body>
<div id="message" style="display:none;"> Welcome to my site</div>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/fade.js"></script>
</body>
</html>
javascript 文件位于 js 文件夹中。
fade.js 代码是:-
$(document).ready(function() {
$('#message').fadeIn('slow');
});
jquery代码是我从jquery网站下载的 我尝试了版本 1 和 2 的制作 以及其他源链接,例如
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
还有一些用户使用的 jquery 源链接。 我还尝试将脚本代码移至标签上方。 但无论如何,我尝试在任何浏览器中都无法工作。
请帮帮我...!!
最佳答案
function
应该是 function
并在脚本之前加载 jQuery
。
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
$(document).ready(function() {
/*^^^^^^*/
$('#message').fadeIn('slow');
});
关于javascript - 我的 jquery 代码无法在任何浏览器中运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27341503/