Bootstrap Combobox
Provides combobox as a Twitter Bootstrap component, based on dropdown (which is compatible down to IE7).
See demo.
Get started
Files of this component can be download from the source repository: js/
It requires jQuery 1.10+ & Twitter Bootstrap 3+.
It's also available as a NPM package: npm install bootstrap-combobox
Setup
Combobox plugin can be applied on select
elements, to turn them into comboboxes.
<!-- Dependencies --> <!-- UI dependencies --> <!-- HTML to be rendered as a combobox --> <!-- ... --> <!-- Install combobox UI on the select -->
API reference
selectedOption
.btComboBox('selectedOption')
Returns selected option ([val, label, element]
) or null
(if none).
var o = ;var val = o0 label = o1 elem = o2;
value
.btComboBox('value')
Returns value of selected option.
var v =
select
.btComboBox({'action':"select",'value':"V"})
Selects option matching given value (if one).
clear
.btComboBox('clear')
Removes all options and unselect value.
load
.btComboBox({'action':"load", parameters})
Appends options, using given parameters
properties.
pairs
: Array of option to be appended; Each array element should be either[val,label]
, or anything else if nextextractor
property is provided. If pair is['_',null]
it will be a divider.extractor
(optional, required if elements ofpairs
array aren't[val,label]
): Function(element of pairs) => [value, label]
.
; // OR
reset
.btComboBox({'action':"reset", parameters})
Reset options, using same parameters
as load method.
Keep value selection (if value is still available in new options).
values
.btComboBox('values')
Returns values from all available options.
var vs =
disable/enable
.btComboBox('disable')
/ .btComboBox('enable')
Disable/enable combobox.
;;
Events
change
Fired when combobox value is changed.