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.
Also you can try
that's because you cannot trigger call the tabs() in ready mode. document.ready is executed earlier than window.load.
As info (in case someone stumbles upon this later and gets an error on the select method) - In jQuery-UI 1.9+, the select method was deprecated.
(http://jqueryui.com/upgrade-guide/1.9/#deprecated-select-method)
Use the option method, example:
You have to make the trigger call to "a" inside the "li", not direct to the tab "div" like it's done.
Example:
http://jsfiddle.net/Tf9sc/152/
Use
onclick='$("#tabs").tabs( "select", "tabs-2" )'
http://jqueryui.com/demos/tabs/#method-select
js fiddle
http://jsfiddle.net/maheshvemuri/M7Fdu/
Here is JS part of the code:
Here are the "a href" tags to be added in your tabs div
Example: