Focusing Input after Select2 close event fire

梦想的初衷 提交于 2019-12-01 14:30:26
ahmad molaie

take a look here, this question is already has an answer: Blur select2 input after close

.on("select2-close", function () {
    setTimeout(function() {
        $('.select2-container-active').removeClass('select2-container-active');
        $(':focus').blur();
        $("#elementid").focus();
    }, 1);
});

elementid is the id element you want to be focused after select2 closese. i have just added $("#elementid").focus(); to the answer at link.

use css:

html, body {
    height:100%
}

Try this one as it works:

$('#select2').on('select2:close', function (e)
{
   // your focus code for element
});
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!