当JQuery autocompleteselect
被触发时,我如何获取底层的select
元素?我需要这个元素来触发它的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"
});
发布于 2018-06-09 19:41:42
最后我想通了:
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();
}
希望这对将来的人有所帮助。:)
https://stackoverflow.com/questions/50772931
复制相似问题