O'Reilly logo

jQuery UI by Eric Sarrion

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required