0

在 IE9 上运行良好的页面。在 IE8 上,我收到以下错误:

无效的论点。jquery.js,第 5875 行第 5 个字符。这一行是:

this.parentNode.insertBefore( elem, this.nextSibling );

我正在使用 jQuery JavaScript 库 v1.7.2

4

1 回答 1

0

Rocket的评论非常有用。是的,在IE中调试后发现问题出在insertAfter方法上。与 IE9/Mozilla 相比,如果调用 insertAfter 的元素不存在,IE8 不会原谅。因此,需要检查 NULL 之类的东西。

因此,在这种情况下,我们添加了元素长度检查,示例如下: if($('#footer').length) { $('#footer').insertAfter('#content').addClass('white中心 padding_half'); }

于 2012-08-23T15:01:19.973 回答