Can you please let me know how I can set the active tab in jquery ui with a button click out of the tabs?
I have a button like:
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.
Inside your function for the click action use
$( "#tabs" ).tabs({ active: # });
Where #
is replaced by the tab index you want to select.
Simple jQuery solution - find the <a>
element where href="x"
and click it:
$('a[href="#tabs-2"]').click();
just trigger a click, it's work for me:
$("#tabX").trigger("click");
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
If you want to set the active tab by ID instead of index, you can also use the following:
$('#tabs').tabs({ active: $('#tabs ul').index($('#tab-101')) });