JqueryUI Autocomplete prevent close on click outside

烈酒焚心 提交于 2019-12-13 01:25:48

问题


Is there a solution to prevent hidding search results after an outside click? I have a long-running ajax request and don't want to sit and wait untill it is finished. It has to work in background and close results on ESC key is pressed or on one of the results is selected, but if I click outside, the autocomplete even doesn't show the result.

I tried something like this, but it doesn't work properly:

...
    close : function (event, ui) {
        if ($("ul.ui-autocomplete, .ui-widget-content").filter(':hidden').length>0 && event.keyCode !== $.ui.keyCode.ESCAPE) {
            $("ul.ui-autocomplete, .ui-widget-content").filter(':hidden').show();
        }
    }

来源:https://stackoverflow.com/questions/34396068/jqueryui-autocomplete-prevent-close-on-click-outside

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!