jQuery tabs selecting specific tab

前端 未结 5 2063
粉色の甜心
粉色の甜心 2021-01-18 03:22

I have a page containing a set of jQuery tabs. All the tabs point at the same target div, but load it with different content via ajax. When I perform the initial full page

5条回答
  •  南笙
    南笙 (楼主)
    2021-01-18 04:18

    Change this:

    html.Append("$(\"#panelTabs\").tabs({selected: 2});");
    

    To this:

    html.Append("$(\"#panelTabs\").tabs('option','selected', 2);");
    

    Edit: and...

    $(function() {
            $("#panelTabs").tabs({
                ajaxOptions: {
                    error: function(xhr, status, index, anchor) {
                        $(anchor.hash).html("Couldn't load this tab. We'll try to fix this as soon as possible.");
                    }},
                select: function(event, ui) {
                    getPage('hps.aspx?cmd=zz_' + ui.tab.id, 'panelA');
                }
            });    
    
        });
    

提交回复
热议问题