Read more at http://coffeescripter.com/2009/07/an-editable-select-list-plugin-for-jquery/ | More code at Coffeescripter.com
selected attribute,
it's value is put inside the text inputaddOption()Download all the files required
When the plugin runs, it replaces the select with an input field, and sets the
id of the input to the id of the select. The id of the select is then set to
[real id]_hidden_select. If the element has no id, the id is set to
editable-select[0-9]. Beginning with 1.3.2, it also copies all
class names from the select to the input.
$(function() {
$('.editable-select').editableSelect(
{
bg_iframe: true,
onSelect: function(list_item) {
alert('List item text: '+ list_item.text());
// 'this' is a reference to the instance of EditableSelect
// object, so you have full access to everything there
alert('Input value: '+ this.text.val());
},
case_sensitive: false, // If set to true, the user has to type in an exact
// match for the item to get highlighted
items_then_scroll: 10 // If there are more than 10 items, display a scrollbar
}
);
var select = $('.editable-select:first');
var instances = select.editableSelectInstances();
instances[0].addOption('Germany, value added programmatically');
});
If you have any feedback on this, please send it as a comment or email me at andy at-no-spam coffeescripter dot-no-spam com.
Thanks to Niklas Ohlsson for a lot of bug testing and helping out with feature ideas.