【发布时间】:2014-04-03 02:41:29
【问题描述】:
我是第一次尝试使用 jQuery,我正在手动编写代码。但是我的 jQuery 代码根本不起作用……这是我的设置:
Index.html
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<link href="mainCSS.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="mainJQuery.js"></script>
</head>
<body>
<div class="test"> </div>
</body>
</html>
mainCSS.css
.test {
background-color:#FF0004;
border-radius:25px;
display:block;
height:500px;
width:500px;
}
mainJQuery.js
// JavaScript Document
$(document).ready(function() {
$('.test').click(function() {
$('.test').fadeOut('slow');
});
});
【问题讨论】:
-
在这里工作
:)~> 演示 jsfiddle.net/y76B7可能缺少<script type='text/javascript' src='//code.jquery.com/jquery-1.9.1.js'></script> -
为 Firefox 获取像 Firebug 这样的工具。当然,您的 javascript 控制台中有错误会告诉您问题所在。如果我不得不猜测,您没有正确包含核心 jQuery 脚本。
-
该代码中没有 jQuery 脚本?
-
你链接到JQuery脚本了吗?
-
你链接了 jquery 库吗?
标签: javascript jquery