IE9不接受标准的jQuery语法 [英] IE9 not accepting standard jQuery Syntax
问题描述
这真的很简单。我有以下代码..它适用于所有其他html5兼容浏览器(Safari 5,Chrome 9,FireFox),但在IE9(RC)中我收到以下错误。
It's really pretty simple. I have the following code.. and it works in every other html5 compatible browser (Safari 5, Chrome 9, FireFox), but in IE9 (RC) I get the following errors.
行:16
错误:对象不支持属性或方法'getElementsByTagName'
Line: 16 Error: Object doesn't support property or method 'getElementsByTagName'
jquery-ui.min.js
jquery-ui.min.js
行:40
错误:对象不支持属性或方法'tabs'
Line: 40 Error: Object doesn't support property or method 'tabs'
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=9" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/jquery-ui.min.js"></script>
<script type="text/javascript">
$(function () {
$("#ribbon").tabs();
});
</script>
</head>
<body>
<header>
<span id="branding"></span>
<div id="ribbon-navigation">
<div id="ribbon">
<ul>
<li><a href="#ribbon-1">1</a></li>
<li><a href="#ribbon-2">2</a></li>
<li><a href="#ribbon-3">3</a></li>
<li><a href="#ribbon-4">4</a></li>
</ul>
<div id="ribbon-1" class="ribbon-strip">
@Html.Partial("Menus/Ribbons/__H1")
</div>
<div id="ribbon-2" class="ribbon-strip">
@Html.Partial("Menus/Ribbons/__2")
</div>
<div id="ribbon-3" class="ribbon-strip">
@Html.Partial("Menus/Ribbons/__3")
</div>
<div id="ribbon-4" class="ribbon-strip">
@Html.Partial("Menus/Ribbons/__4")
</div>
</div>
</div>
</header>
</body>
</html>
我能理解我的CSS是不是产生了合适的样式 - 但它看起来像是彻头彻尾的忽略 $(#ribbon)。tabs();
一起。任何想法?
I could understand if my CSS just didn't produce the right styles - but it looks like it's outright ignoring $("#ribbon").tabs();
all together. Any ideas?
推荐答案
进一步挖掘取得了更丰硕的成果... bugs.jquery.com/ticket/8052 - 这显然是IE中的一个错误,并在昨天出现的jQuery更新中得到修复!我不得不引用jQuery 1.5.1,它一切正常。
Further digging yielded more fruitful results... bugs.jquery.com/ticket/8052 - This is apparently a bug in IE, and was fixed in an update of jQuery that came out Yesterday of all times! I had to reference jQuery 1.5.1, and it all worked fine.
感谢所有参与其中的人提供了有用的建议。它们都是非常好的想法,但这一次它只是IE9的一个错误,仅此而已。
Thank you to everyone who jumped in with helpful suggestions. They were all very good ideas, but this time it turned out to simply be a bug with IE9 and nothing more.
这篇关于IE9不接受标准的jQuery语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!