0

我试图让 jQuery 选项卡表现得像 IE 和 Firefox。我有几个标签,最后有一个“addtab”。单击此选项卡时,会添加一个新选项卡,这很好。但我想选择倒数第二个标签。事实证明这是相当困难的。我的初始化代码是

 $tabs =$("#tabs").tabs({
    add: function(event, ui) {
        $tabs.tabs('select', $tabs.tabs( 'length' ) -2);
        alert ("after setting tab");
    }
});

我的添加标签代码是

 $("#addtab").click(function(){
    showcal();
    // The first thing to do is to deselect all the other selections
    $("#tabs .ui-corner-top").each (function () {
        $(this).removeClass ("ui-tabs-selected ui-state-active").addClass ("ui-state-default");
    });
    $tabs.tabs('add','#extra','Generate Report', ($tabs.tabs('length')-1));
    tabContainerTabCount++;

});

但是在添加回调中,以下行正在重置选定的选项卡

self._trigger('select', null, self._ui(this, $show[0])) === false)

如果有人有任何解决方案或这样做的原因,你能告诉我吗

谢谢

约翰

4

1 回答 1

0

我在以下网页 http://forum.jquery.com/topic/ui-tabs-unable-to-set-index-after-add#14737000000698077中被指出了答案

谢谢 tsukasa1989

于 2010-02-09T16:14:06.530 回答