Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 348
Christopher Avatar asked Dec 30 '10 18:12

Christopher


People also ask

How do I change the default tab on a page load?

Set the active property in the object you pass to the tabs function to the index of the tab you want to make default. Index starts at 0. So to make the third tab the default: $("#tabs").

What is jquery tab?

Tabs are the set of logically grouped content that facilitates users to flip between them. Tabs save the space like accordions. Every tab must use the following set of markups to work properly. Tabs must be in an ordered <ol> or unordered <ul> list.


1 Answers

Please note that this option got renamed in jqueryui 1.9, it is now called "active" (hope this saves someone else the headache I just went through):

$('#tabid').tabs({   active: index }); 

or

$('#tabid').tabs("option", "active", index); 

See: http://api.jqueryui.com/tabs/#option-active

like image 192
redreinard Avatar answered Sep 21 '22 21:09

redreinard