滚动选项列表时,突出显示的值不会显示在搜索框中。我正在使用 jquery-ui 版本 1.10.3。当我通过键盘选择它们时,它工作正常。
代码:
_createAutocomplete: function () {
var selected = this.element.children(":selected"),
selectedvalue = selected.text()
? selected.text() : "";
this.input = $("<input>")
.appendTo(this.wrapper)
.val(selectedvalue)
.attr("title", "")
.addClass("custom-combobox-input ui-widget ui-widget-content ui-state-default ui-corner-left")
.autocomplete({
minLength: 4,
source: $.proxy(this, "_source")
})
.tooltip({
tooltipClass: "ui-state-highlight"
});
this._on(this.input, {
autocompleteselect: function (event, orgselect) {
var newvar = this.input.val();
$("#control option").filter(function () {
return this.value == newvar;
}).attr('selected', true);
this.input.val($("#control option:selected").text());
},
autocompletechange: "_removeIfInvalid"
});