当JQuery select
被触发时,如何获取基础autocompleteselect
元素?我需要该元素来激活它onchange()
。底层select
元素是ASP.NET DropDown控件。这是代码:
this._on(this.input, {
autocompleteselect: function (event, ui) {
var ele = this; //<---not working
ui.item.option.selected = true;
this._trigger("select", event, {
item: ui.item.option
});
},
autocompletechange: "_removeIfInvalid"
});
答案 0 :(得分:0)
最后我明白了:
autocompleteselect: function (event, ui) {
ui.item.option.selected = true;
this._trigger("select", event, {
item: ui.item.option
});
var underlyingEle = document.getElementById(
ui.item.option.parentElement.id // <-- fetching the underlying select element
);
underlyingEle.onchange();
}
希望这有助于将来的某些人。 :)