hide()函数上的jQuery IE8错误

时间:2010-08-18 12:21:03

标签: jquery internet-explorer

我收到以下错误:

  

jquery1.4.2.js
  行:2828
  错误:Object不支持该方法。

我的JavaScript代码:

$(document).ready(function () {
    //When page loads...
    $(".tab_content").hide(); //Hide all content
    $("ul.tabs li:first").addClass("active").show(); //Activate first tab
    $(".tab_content:first").show(); //Show first tab content
    //On Click Event
    $("ul.tabs li").click(function () {
        $("ul.tabs li").removeClass("active"); //Remove any "active" class
        $(this).addClass("active"); //Add "active" class to selected tab
        $(".tab_content").hide(); //Hide all tab content
        var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
        $(activeTab).fadeIn(); //Fade in the active ID content
        return false;
    });
});

在FireFox上它的工作方式应该如此!

感谢您的帮助!

1 个答案:

答案 0 :(得分:0)

你可以在click事件上加上debugger;语句,如下所示:

$("ul.tabs li").click(function () {
    debugger;
    $("ul.tabs li").removeClass("active"); //Remove any "active" class

然后你应该能够在弹出窗口中选择这样做。

它实际上是否在它在控制台中所说的那一行失败了?