Christopher Christopher - 4 months ago 6x
jQuery Question

Set default tab in jQuery UI Tabs

I have a monthly calendar with just basic HTML tables, with each month in a jQuery UI tabs tab. How can I change which jQuery UI tab is loaded by default? I want to keep the months in order in the navigation, but have the current month show on page load.



The API has changed since my original answer and the release of jQuery 1.9. The preferred approach is to use the active option as mentioned in redreinard's answer.

Older Approach (pre jQuery 1.9)

According to the documentation on the JqueryUI Tabs, you could set this by using the available select function as seen in either the approaches below :

// index will be the index of the tab that you wish to select
$('selector').tabs( "select" , index )
$('selector').tabs({ selected: index });