Search code examples
ajaxjquery-uijquery-tabs

Change active tab on button click


I have two tabs generated by jquery-ui. I do something in the Tab1 and on a button click, there is an AJAX call which displays the results in Tab2.

So I want to change the active tab on button click ( after the ajax call finishes ). Can I do so?

I've created a jsFiddle here


I tried onclick='$("#tabs-2").trigger("click") '> but it didn't do anything.


Solution

  • Use onclick='$("#tabs").tabs( "select", "tabs-2" )'

    http://jqueryui.com/demos/tabs/#method-select