DropKick constructor

Call new Dropkick( HTMLSelectElement, Options ); or new Dropkick( "ID", Options ); in your script to create a new DropKick.

Constructor

Dropkick ()

Defined in lib/dropkick.js:22

Methods

add
(
  • elem
  • before
)

Defined in lib/dropkick.js:234

Adds an element to the select. This option will not only add it to the original select, but create a Dropkick option and add it to the Dropkick select.

Parameters:

  • elem String

    HTMLOptionElement

  • before Node/Integer

    HTMLOptionElement/Index of Element

build
(
  • sel
)
Object
private

Defined in lib/dropkick.js:998

Builds the Dropkick element from a select element

Parameters:

  • sel Node

    The HTMLSelectElement

Returns:

Object:

An object containing the new DK element and it's options

close ()

Defined in lib/dropkick.js:448

Closes the DK dropdown

delegate ()
private

Defined in lib/dropkick.js:795

disable
(
  • elem
  • disabled
)

Defined in lib/dropkick.js:510

Disables or enables an option; if only a boolean is passed (or nothing), then the entire Dropkick will be disabled or enabled.

Parameters:

  • elem Integer

    The element or index to disable

  • disabled Boolean

    Value of disabled

dispose ()

Defined in lib/dropkick.js:751

Removes the DK Object from the cache and the element from the DOM

focus ()

Defined in lib/dropkick.js:703

Brings focus to the proper DK element

handleEvent ()
private

Defined in lib/dropkick.js:765

highlight ()
private

Defined in lib/dropkick.js:840

init
(
  • sel
  • opts
)
Object
private

Defined in lib/dropkick.js:319

Initializes the DK Object

Parameters:

  • sel Node

    [description]

  • opts Object

    Options to override defaults

Returns:

Object:

The DK Object

item
(
  • index
)
Node

Defined in lib/dropkick.js:292

Selects an option in the list at the desired index (negative numbers select from the end).

Parameters:

  • index Integer

    Index of element (positive or negative)

Returns:

Node:

The DK option from the list, or null if not found

keyHandler ()
private

Defined in lib/dropkick.js:857

onDocClick
(
  • event
)
private

Focus DK Element when corresponding label is clicked; close all other DK's

Parameters:

  • event Object

    Event from document click

open ()

Defined in lib/dropkick.js:473

Opens the DK dropdown

refresh ()

Defined in lib/dropkick.js:741

Rebuilds the DK Object (use if HTMLSelectElement has changed)

remove
(
  • index
)

Defined in lib/dropkick.js:304

Removes the option (from both the select and Dropkick) at the given index.

Parameters:

  • index Integer

    Index of element (positive or negative)

reset
(
  • clear
)

Defined in lib/dropkick.js:714

Resets the Dropkick and select to it's original selected options; if clear is true, It will select the first option by default (or no options for multi-selects).

Parameters:

  • clear Boolean

    Defaults to first option if True

scrollTo ()
private

Defined in lib/dropkick.js:966

searchOptions ()
private

Defined in lib/dropkick.js:931

select
(
  • elem
  • disabled
)
Node

Defined in lib/dropkick.js:539

Selects an option from the list

Parameters:

  • elem String

    The element, index, or value to select

  • disabled Boolean

    Selects disabled options

Returns:

Node:

The selected element

selectOne
(
  • elem
  • disabled
)
Node

Defined in lib/dropkick.js:615

Selects a single option from the list and scrolls to it (if the select is open or on multi-selects). Useful for selecting an option after a search by the user.

Parameters:

  • elem Integer

    The element or index to select

  • disabled Boolean

    Selects disabled options

Returns:

Node:

The selected element

Properties

disabled

Boolean

Defined in lib/dropkick.js:340

Whether the form is currently disabled or not

form

Node

Defined in lib/dropkick.js:347

The form associated with the select

length

Integer

Defined in lib/dropkick.js:354

The number of options in the select

multiple

Boolean

Defined in lib/dropkick.js:361

If this select is a multi-select

options

Array

Defined in lib/dropkick.js:368

An array of Dropkick options

selectedIndex

Integer

Defined in lib/dropkick.js:375

An index of the first selected option

selectedOptions

Array

Defined in lib/dropkick.js:382

An array of selected Dropkick options

value

String

Defined in lib/dropkick.js:389

The current value of the select

Attributes

change

Function

Defined in lib/dropkick.js:78

Called whenever the value of the Dropkick select changes (by user action or through the API). The value of this is the Dropkick object itself.

close

Function

Defined in lib/dropkick.js:97

Called whenever the Dropkick select is closed. The value of this is the Dropkick object itself.

initialize

Function

Defined in lib/dropkick.js:68

Called once after the DK element is inserted into the DOM. The value of this is the Dropkick object itself.

open

Function

Defined in lib/dropkick.js:88

Called whenever the Dropkick select is opened. The value of this is the Dropkick object itself.