始终保持 ui 自动完成功能打开 [英] keep ui autocomplete open at all times

查看:28
本文介绍了始终保持 ui 自动完成功能打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 ui 自动完成功能:在这里

I'm using the ui autocomplete: over here

我需要自动完成功能始终处于打开状态,因此在单击正文中的某处时它不应关闭.我用谷歌搜索了这个,但我找不到任何东西.

I need the autocomplete to be open at all times, so it shouldn't close when somewhere in the body is clicked. I have googled this but I couldn't find anything.

推荐答案

这里是如何做到这一点的工作示例:http://jsfiddle.net/4pk3V/

here's a working example of how to do it : http://jsfiddle.net/4pk3V/

每当触发关闭事件时,通过再次搜索相同的输入来保持自动完成框打开:

keep your autocomplete box open by searching the same input again whenever close event is triggered:

$( "#input" ).autocomplete({
    source: availableTags,

    close : function (event, ui) {
         val = $("#comment").val();
         $("#input").autocomplete( "search", val ); //keep autocomplete open by 
         //searching the same input again
         $("#input").focus();
        return false;  
    }
});

这篇关于始终保持 ui 自动完成功能打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆