开发者

activate jquery tabs using a different button

Is it possible to activate a t开发者_开发百科ab using an external button?

for example, if I have 3 tabs, is it possible to get button1 to activate tab 1, button2 to active tab 2 and so on?

I have the following script so far:

http://jsfiddle.net/FXTVG/


Yes of course, you should use:

 $("#button1").click(function() {$("#myTabId").tabs( "select" , 0 );});
 $("#button2").click(function() {$("#myTabId").tabs( "select" , 1 );});
 $("#button3").click(function() {$("#myTabId").tabs( "select" , 2 );});


jQuery UI 1.9 deprecated the select method, you should use the "active" option:

$("#myTabId").tabs("option", "active", 1);

http://api.jqueryui.com/tabs/

http://jqueryui.com/upgrade-guide/1.9/#deprecated-select-method

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜