jQuery 1.6.1、IE9 和 SCRIPT5009:'$' 未定义

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6203846/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 20:32:36  来源:igfitidea点击:

jQuery 1.6.1 , IE9 and SCRIPT5009: '$' is undefined

jqueryinternet-explorer-9

提问by utopia

There is

SCRIPT5009: '$' is undefined

SCRIPT5009: '$' 未定义

<script type="text/javascript" src="xxx_files/jquery.js"></script>
<script type="text/javascript" src="xxx_files/jquery_002.js"></script>
<script type="text/javascript" src="xxx_files/ticker.js"></script>
<script type="text/javascript" src="xxx_files/config.js"></script>
<script type="text/javascript" src="xxx_files/ajax.js"></script>
<script type="text/javascript" src="xxx_files/lite.js"></script> 
<script type="text/javascript" src="xxx_files/jquery.pagination.js"> </script>
<script type="text/javascript">
$(document).ready(function(){
    $('#slide').pajinate({
          num_page_links_to_display : 0,
       items_per_page : 4
    });
 });
 </script>

with jQuery 1.6.1 in IE9 . Why '$' is undefined in ie9 ?

在 IE9 中使用 jQuery 1.6.1。为什么 '$' 在 ie9 中未定义?

Thanks in advance

提前致谢

回答by Brett

Do you have another script using jQuery before jQuery is referenced?

在引用 jQuery 之前,您是否有另一个使用 jQuery 的脚本?

回答by SZT

FOR BEGINNERS:

对新手而言:

add this code to your file:

将此代码添加到您的文件中:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js">
</script>

It'll grab the jQuery file from google cdn (according to http://www.w3schools.com/jquery/jquery_intro.asp) I was having this problem

它会从谷歌 CDN 获取 jQuery 文件(根据http://www.w3schools.com/jquery/jquery_intro.asp)我遇到了这个问题

回答by Sobs

This issue is because there is no reference in the page for jquery...Pleaes ensure that the below js reference or above jquery-1.5.1.min.js is added as reference

这个问题是因为页面中没有jquery的引用...请确保添加下面的js引用或上面的jquery-1.5.1.min.js作为引用

<script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>