[英]select2 search textbox looses focus after selecting value from drop down
我在ASP.NET項目中第一次使用select2插件。 我遇到一個問題,即從下拉列表框中選擇項目后,焦點就會丟失。 我對此代碼感到厭倦,但無法正常工作。 請幫我。
$(function () {
//Initialize Select2 Elements
$('.select2').select2(
{
onSelect: function ()
{
this.focus();
}
}
)
});
我在https://github.com/select2/select2/issues/4384#issuecomment-228464364上找到了答案。
$('select').on(
'select2:close',
function () {
$(this).focus();
}
);
謝謝!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.