'$未定义'错误jQuery
'$ is undefined' error jQuery
所以我有以下HTML和jQuery代码,每当我试图加载页面时,Firebug都会给我"ReferenceError:$is undefined"错误;因此,jQuery代码不起作用。我在小牛队使用的是Coda 2.0.9。我在jQuery UI库之前加载了jQuery库(使用Google CDN),在编写脚本之前也加载了这两个库。在Firebug的Net部分,它显示的唯一请求是来自Google字体的字体。这只是一个启动页,所以代码很少。就我的一生而言,我无法理解这一点,所以任何帮助都将不胜感激。
<meta name="description" content="Description here" >
<title>This site is being updated</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
<link href='http://fonts.googleapis.com/css?family=Signika+Negative' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="main.css">
<script type="text/javascript" src="jquery.js"></script>
<h1 class="maintitle"> This site is getting cleared up! </h1>
<img class="construction" src="images/construction_800.png">
<div id='wrapper' style='text-align:center;width:auto; margin: 0px 90px'>
<div style='float:left;width:50%'>
<strong>Office 1</strong> <br>
p. xxx.xxx.xxxx <br>
f. xxx.xxx.xxxx
</div>
<div style='float:right;width:50%'>
<strong>Office 2</strong> <br>
p. xxx.xxx.xxxx <br>
f. xxx.xxx.xxxx
</div>
</div>
<p class="comeback"><strong>Please check back soon for the updated site</strong></p>
</body>
jQuery:
$(document).ready(function() {
$(".maintitle", ".construction", "div", ".comeback").fadeIn("slow");
});
您正在Jquery中的头中加载两次。
删除最后一行
<script type="text/javascript" src="jquery.js"></script>
实际的问题是,jQuery使用的$handler在某个地方发生了冲突。
如果是这样的话,将$更改为像@Choineck这样的jQuery应该是可行的。
jQuery(document).ready(function($) {
$(".maintitle", ".construction", "div", ".comeback").fadeIn("slow");
});
我认为问题是从ajax.google获取jQuery有一点延迟但你也可以试试
<script language="javascript" type="text/javascript">
$j = jQuery.noConflict();
</script>
然后
$j("...")
相关文章:
- 将菜单项与滚动绑定时出现Jquery错误
- 试图获取表单时出现Jquery错误
- 任何人都知道IE7设置或更新/补丁,它可以防止IE因为jquery错误而无法加载页面
- 组中需要Jquery错误位置
- IE9中的Jquery错误
- 使用下拉菜单排除jquery错误
- 在文本区域检查电子邮件数据时出现奇怪的jquery错误
- 扩展对象导致jQuery错误
- 一个经典的jQuery错误 - 未捕获的类型错误:未定义不是一个函数
- 使用ng-include时发生Angular.js jQuery错误
- JQuery 错误 -- 减慢在浏览器中查看错误的操作速度
- 在页面上获取网格数据之前出现 jQuery 错误
- 如何修复我的 JQuery 错误
- jQuery 错误 SCRIPT5002:IE9 64 位中预期的函数
- jQuery错误地导致悬停
- 未定义获取 jquery 错误 $
- 将 jQuery 错误处理添加到列表、网格内的 JSF 页面上的所有图像
- 未捕获的错误:信号器 jquery 错误
- JQuery 错误的脚本顺序
- 当展开点击 li 的 ul 事件时,JS JQUERY 错误不起作用