How to Set Active Tab in jQuery Ui How to Set Active Tab in jQuery Ui jquery jquery

How to Set Active Tab in jQuery Ui


Inside your function for the click action use

$( "#tabs" ).tabs({ active: # });

Where # is replaced by the tab index you want to select.

Edit: change from selected to active, selected is deprecated


Simple jQuery solution - find the <a> element where href="x" and click it:

$('a[href="#tabs-2"]').click();


Just to clarify in complete detail. This is what works with the current version of jQuery Ui

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

where # is the index of the tab you want to make active.