jQuery在我的页面上工作,但萤火虫说$没有定义错误。为什么以及如何避免它? [英] jQuery works on my page, but firebug says $ is not defined error. Why and how to avoid it?
问题描述
但是我从你的答案中学到了很多,并且检查了我的代码很多时间。 :)
更新END。
Firebug控制台发出以下错误消息:
$未定义
ajaxlib.js()ajaxlib .js(第6行)
[break on this error] $(document).ready(function()
但jQuery在我的页面上完美运行。 b $ b我在第一个脚本标记中包含jQuery源代码(这是最常用的解决方案),所以应该加载它。
p>
< script language =javascripttype =text / javascriptsrc =js / jquery-1.6.1.min。 js>< / script>
< script language =javascripttype =text / javascriptsrc =js / advexpad_lib.js>< / script>
< script language =javascripttype =text / javascriptsrc =js / ajaxlib.js>< / script>
< script language =javascripttype =text / javascriptsrc = js / highlight.pack.js>< / script>
as in;
$(document).ready(function(){});
至
jQuery(document).ready(function(){});
UPDATE: Finally I found the solution, it was totally my fake. There were an iframe tag on the site, and in the external file I didn't include jQuery. But I learned a lot from your answer and checked my code a lot of time. :) update END.
Firebug console issues the following error message: $ is not defined ajaxlib.js()ajaxlib.js (line 6) [break on this error] $(document).ready(function()
But jQuery works perfectly on my page. I include the jQuery source in the first script tag (it was the most commonly suggested solution), so it's should be loaded.
Any help appreciated.
<script language="javascript" type="text/javascript" src="js/jquery-1.6.1.min.js"></script>
<script language="javascript" type="text/javascript" src="js/advexpad_lib.js"></script>
<script language="javascript" type="text/javascript" src="js/ajaxlib.js"></script>
<script language="javascript" type="text/javascript" src="js/highlight.pack.js"></script>
Try changing all $ characters with "jQuery". They are possibly conflicting with an other library you are including.
as in;
$(document).ready(function() {} );
to
jQuery(document).ready(function() {} );
这篇关于jQuery在我的页面上工作,但萤火虫说$没有定义错误。为什么以及如何避免它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!