Flavio CF Oliveira
Flavio CF Oliveira

Reputation: 5285

JQuery.UI.Tabs default selected by TabID

Is there any simple way to specify the default selected tab on jQueryUI Tabs by tab id, instead the tab index?

Upvotes: 0

Views: 1212

Answers (3)

Stephane Gosselin
Stephane Gosselin

Reputation: 9148

Try something like this maybe:

   //executes on load
    $(function () {
        $("#tabs").tabs({ selected: 2 });
    });

Upvotes: 1

Andrew Whitaker
Andrew Whitaker

Reputation: 126042

You could tap into the create event and select a tab by id there:

$("#tabs").tabs({
    create: function() {
        $(this).tabs("select", "#tabs-2");
    }
});

Upvotes: 0

AlexC
AlexC

Reputation: 9661

var SelectedTab = $('ul li#yourId').index();

$( ".selector" ).tabs({ selected: SelectedTab  })

Upvotes: 1

Related Questions