Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

selecting & loading a jquery tab programmatically

Tags:

jquery

I'm having trouble trying to get this functionality to work. I would like to load a tab automatically when the page loads. I have used the following code.

$tabs.tabs('select', 0); 

However, what's happening is that it's only selecting it and not loading it (that tab loads via ajax). Interestingly when I select another tab and then go back to the 1st tab again then it loads fine.

like image 724
Saumil Shah Avatar asked Jun 09 '09 15:06

Saumil Shah


1 Answers

I just answer to this question to avoid people to misguide with deprecate functions.

Most of the answers were correct at the time of the question, but most of them were not using in new API.

try following code If you are using new API.

$(function() { 
    $( "#tabs" ).tabs(); 
    $( "#tabs" ).tabs( "option", "active", 2 ); 
});

For more details check following link.

http://jqueryui.com/upgrade-guide/1.9/#deprecated-select-method

like image 120
Janith Chinthana Avatar answered Sep 28 '22 12:09

Janith Chinthana