我一直在使用Codecademy上的jQuery进行实验,但是在下载这个库之后它似乎没有工作。无法让jQuery工作
我按照这些步骤:
- 我下载的jQuery 1.9.1从http://jquery.com/download/(http://code.jquery.com/jquery-1.9.1.min.js更具体)
- 我重命名的文件的jquery.js并把它放在同一个源文件夹作为我的HTML /脚本等
- 我链接到它在我的HTML文件
<script src='jquery.js'> </script>
- 我的脚本使用jQuery不起作用。我尝试了一个基本的测试,以查看jQuery是否工作正常 -
$(document).ready(function(){ alert("Hello jQuery"); });
有什么我错过了?
(我的代码工作地很好Codecademy网站,所以我认为这是不太可能在其他地方的问题,在我的程序)
编辑1:
(全部代码,对于那些要求: ))
HTML/jQuery的
<script src='jquery.js'>
$(document).ready(function() {
alert("Hello jQuery!");
$('.matchtile').click(function() {
$(this).fadeTo('slow', 0);
});
$('.button').click(function() {
fadeIn();
});
});
function fadeIn(){
$('.matchtile').fadeTo('slow', 1);
}
</script>
<title></title>
</head>
<body>
<div class="matchtile"></div>
<div class="matchtile"></div>
<div class="matchtile"></div>
<div class="matchtile"></div>
<div class="button"></div>
</body>
CSS
.matchtile {
border-radius: 100%;
background-color: #FF0000;
width: 30px;
height: 30px;
margin: 30px;
}
.button {
background-color: #663333;
width: 30px;
height: 30px;
border-radius: 10%;
margin: 30px;
}
一定要在这里发布一些代码对SO ...它有助于得到正确的答案,很快:) – 2013-05-06 20:52:37
看看你的Javascript控制台 - 你有任何错误?在Chrome中,这个CTRL + SHIFT + I – 2013-05-06 20:52:42
我确实是:)而不是,我不是。 – Eilidh 2013-05-06 20:53:13