我有一个可以在 Firefox、Safari 和 Chrome 中运行的脚本。无论出于何种原因,它都无法在 Internet Explorer 中运行。代码相当简单:
<script type="text/javascript">
(function( $ ){
$.fn.tabSwap = function() {
return this.each(function() {
$('.current').removeClass('current');
$(this).addClass('current');
});
};
})( jQuery );
</script>
关于a fairly simplified page (由 Roatin Marth 发布)该代码在 IE 6 和 IE 8 中运行良好。在 my webpage 上该代码在 Internet Explorer 中根本不起作用。
我尝试执行以下简单代码:
<script type="text/javascript">
$('#statistics').tabSwap();
</script>
我收到以下错误:
block 引用>Object doesn't support this property or method
index.html line: 77
code: 0 char: 2
URI: ...
我的网页链接是:
http://examples.chikachu.com/calculators
有什么问题吗?
最佳答案
答案由 Crescent Fresh 发布,但他没有将其作为答案发布,因此我可以接受它。我网站上的问题是 <script>
的关闭不当。标签用于包含 jQuery 框架。
更具体地说,this issue.
关于javascript - Internet Explorer 和 jQuery 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4026192/