首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >在触发ASP.NET autocompleteselect时获取WebForms ComboBox元素

在触发ASP.NET autocompleteselect时获取WebForms ComboBox元素
EN

Stack Overflow用户
提问于 2018-06-09 17:44:45
回答 1查看 33关注 0票数 0

当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"
        });
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 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();
}

希望这对将来的人有所帮助。:)

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50772931

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档