new Dropdownizer(el)
Creates a new Dropdownizer instance.
Parameters
el:String|HTMLElement
The element(s) to dropdownize.
Throws
-
- Type
- :TypeError
Throws if an unexpected argument was passed in. -
- Type
- :ReferenceError
Throws if no such element exists in the DOM. -
- Type
- :ReferenceError
Throws if your element has already been dropdownized. -
- Type
- :ReferenceError
Throws if your element already has the reserved class name 'dropdownizer.'
Details
Source: Dropdownizer.js, line 13
Members
selectedItem:Array|Object
Gets information about the currently selected list item(s).
Source: Dropdownizer.js, line 49
Methods
(static) preventNative()
Prevents native mobile dropdowns. If prevented, dropdowns on mobile/touchable devices will work as
they do on desktops.
Source: Dropdownizer.js, line 174
addItem(value, attributesopt, atopt):Dropdownizer
Adds list items. Note that this method properly syncs your original select elements.
Parameters
value:String
The items value.
attributes:Object
= {}
(optional)Attributes to add to the list item. The supported
properties are 'label', 'disabled', and 'selected'.
at:Number
= NaN
(optional)The index in which to insert your new list item
(defaults to the last item if not set). Use a
negative number to insert from the end of the list.
Throws
- Type
- :RangeError
Throws if the index is out of bounds.
Returns
- Type
- :Dropdownizer
The Dropdownizer instance.
Source: Dropdownizer.js, line 121
change(callback):Dropdownizer
Listens for change events.
Parameters
callback:function
The callback function to execute when a list item changes.
Returns
- Type
- :Dropdownizer
The Dropdownizer instance.
Details
- Deprecated
- This method has been renamed to 'onChange'.
Source: Dropdownizer.js, line 61
destroy(resetOriginalElementopt):Dropdownizer
Removes listeners and destroys the dropdownizer instances.
Parameters
resetOriginalElement:Boolean
= false
(optional)
Whether to reset the original 'select' elements.
Returns
- Type
- :Dropdownizer
The Dropdownizer instance.
Source: Dropdownizer.js, line 158
disable():Dropdownizer
Disables the dropdowns.
Returns
- Type
- :Dropdownizer
The Dropdownizer instance.
Source: Dropdownizer.js, line 148
enable():Dropdownizer
Enables the disabled dropdowns.
Returns
- Type
- :Dropdownizer
The Dropdownizer instance.
Source: Dropdownizer.js, line 139
onChange(callback):Dropdownizer
Listens for change events.
Parameters
callback:function
The callback function to execute when a list item changes.
Returns
- Type
- :Dropdownizer
The Dropdownizer instance.
Source: Dropdownizer.js, line 71
onClose(callback):Dropdownizer
Listens for close events.
Parameters
callback:function
The callback function to execute when a dropdown is closed.
Returns
- Type
- :Dropdownizer
The Dropdownizer instance.
Source: Dropdownizer.js, line 91
onOpen(callback):Dropdownizer
Listens for open events.
Parameters
callback:function
The callback function to execute when a dropdown is opened.
Returns
- Type
- :Dropdownizer
The Dropdownizer instance.
Source: Dropdownizer.js, line 81
removeItem(at):Dropdownizer
Deletes list items. Note that this method properly syncs your original select elements.
Parameters
at:Number|String
The list items index or name. Use a negative number to select
from the end of the list. Note that if using a string, letter case
is ignored.
Throws
-
- Type
- :Error
Throws if your search returns multiple matches. -
- Type
- :RangeError
Throws if the index is out of bounds.
Returns
- Type
- :Dropdownizer
The Dropdownizer instance.
Source: Dropdownizer.js, line 105
removeListeners():Dropdownizer
Removes all listeners.
Returns
- Type
- :Dropdownizer
The Dropdownizer instance.
Source: Dropdownizer.js, line 130
selectItem(at):Dropdownizer
Programmatically selects list items.
Parameters
at:Number|String
The list items index or name. Use a negative number to select
from the end of the list. Note that if using a string, letter case
is ignored.
Throws
-
- Type
- :Error
Throws if your search returns multiple matches. -
- Type
- :RangeError
Throws if the index is out of bounds.
Returns
- Type
- :Dropdownizer
The Dropdownizer instance.
Source: Dropdownizer.js, line 40