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 selectable () Method

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

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

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

The selectable (options) Method

The selectable (options) method declares that an HTML element contains selectable items. The options parameter specifies behavior when selecting.

Managing selected items

All items that are in the descendants of the elements on which the selectable (options) method applies are selectable and inherit the ui-selectee CSS class (whether selected or not). The options listed in Table 11-1 allow you to filter the elements of the descendants to indicate those that will actually be selectable.

Table 11-1. Options for specifying the selectable elements

Option

Function

options.disabled

When set to true, disables the selection mechanism. Users cannot select the elements until the mechanism is restored using the selectable ("enable") instruction.

options.filter

Selector indicating which elements can be part of the selection. These will inherit the ui-selectee class and will be selectable. By default, the selector is "*" (all the elements of the descendants can be selected).

options.cancel

Selector indicating the elements on which it is forbidden to start the selection (but may be part of the selection).

options.distance

Distance (in pixels) the mouse must move to consider the selection in progress. This is useful, for example, to prevent simple clicks from being interpreted as a group selection.

The default value ...

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