Documentation
Usage
JS
Simple, as usual. To init Editable Combo, just do the following:
$('my_select_box').editableCombo(options);
HTML
Any plain old HTML <select> element. Buttons and others are added automatically by the plugin.
CSS
Feel free to customize it to make it look better. In all cases, the default look is OK, but you might want to adapt it a little.
Options
The plugin provides several options so that you can make it work the way you want. Here there are:
- comboBox: 'select:first'
Selector for the <select> element - add: ':button:first'
Selector for the "+" button - del: ':button:last'
Selector for the "-" button - editableClass: 'editableOption'
The class which will be applied to options that are editable - maxlength: 35
The maximum length for options - multiple: [true, false]
Whether to allow multiple selection or not - onAddOption: function(newVal, newLabel) {}
Callback on adding action. First parameter is the value of the added option, second one is the label. - onRemoveOption: function(oldVal) {}
Callback on removing action. The value of the removed option is passed as a parameter. - onEditOption: function(val, oldLabel, newLabel) {}
Callback on editing action. First parameter is the value of the edited option, second one is the old label, last one is the new label.