Search code examples
jqueryjquery-uijquery-ui-tabs

activate jquery tabs using a different button


Is it possible to activate a tab 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/


Solution

  • 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 );});