通过单击选项卡之外的链接来设置活动选项卡?

问题描述:

我正在使用jQuery UI选项卡: http://api.jqueryui.com/tabs/

Im using the jQuery UI Tabs: http://api.jqueryui.com/tabs/

如何在我的页面上的标签之外建立链接,单击该链接以使某个标签处于活动状态?谢谢

How can I make a link on my page thats outside of the tabs, when clicked make a certain tab active? Thanks

请参见 http://api.jqueryui.com/tabs/#option-active

要获取当前的活动标签索引,请执行以下操作:

To get current active tab index:

var currentActive = $( ".selector" ).tabs( "option", "active" );

要设置当前的活动标签,请执行以下操作:

To set current active tab:

$( ".selector" ).tabs( "option", "active", <number of tab> );

例如:

$('a').click(function(){
         $( ".tabs" ).tabs( "option", "active", 2 );
});