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

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.