![](/img/trans.png)
[英]jQuery Autocomplete on select of a menu item, how to override the focus back into the input?
[英]How to remove focus from Kendo UI AutoComplete when an Item is selected and set focus on an input element?
選擇項目后,我試圖將焦點從Kendo UI自動完成轉移到輸入元素。 我已經嘗試過了...
select: function (e) {
e.preventDefault();
var dataItem = this.dataItem(e.item.index());
vm.selectedProductID(dataItem.ProdID);
$('#itemQtyBox').focus();
}
但這沒有用。
似乎您無法從select
處理程序內部更改焦點...也許稍等片刻然后再執行即可。 我的意思是:
select : function (e) {
setTimeout(function () {
$("#itemQtyBox").focus();
}, 100);
}
我要做的是設置一個超時(在前面的示例中為0.1秒),然后更改焦點(我知道它不好,但是可以工作)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.