The tabs () Method

The tabs () method can be used in two forms:

  • $(selector, context).tabs (options)

  • $(selector, context).tabs ("action", params)

The tabs (options) Method

The tabs (options) method declares that an HTML element (and its contents) should be managed as tabs. The options parameter is an object to specify the appearance and behavior relevant to the tabs. Different types of options are available, depending on whether they manage tabs directly or events related to tabs.

Tab appearance and behavior

Table 2-1 describes the options for modifying the appearance and behavior of tabs.

Table 2-1. Options for managing tab appearance and behavior

Options

Function

options.collapsible

Set to true, it allows tabs to be deselected. When set to false (the default), clicking on a selected tab does not deselect (it remains selected).

options.disabled

Uses an array to indicate index tabs that are disabled (and therefore cannot be selected). For example, use [0, 1] to disable the first two tabs.

options.selected

Indicates the index of the first selected tab. The default is 0, indicating the first tab on the page.

options.event

Name of the event that lets users select a new tab (the default is "click"). If, for example, this option is set to "mouseover", passing the mouse over a tab will select it.

options.fx

Indicates the effect that accompanies selection of the tab, such as a progressive display of the tab and its contents (indicated by options.fx = {opacity: "toggle"}).

options.ajaxOptions

Specifies options ...

Get jQuery UI now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.