自动完成显示所有选项 [英] autocomplete show all options on focus

查看:59
本文介绍了自动完成显示所有选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用此插件.

当输入字段获得焦点时,如何显示下拉列表中所有可用的选项?现在,我必须为插件输入一些内容以过滤选项.

How do I show all the options available in the dropdown for an input field when it receives focus? Right now , I have to type something for the plugin to filter the options.

我现在拥有的

var $sessionTimes = "00:00 00:15 00:30 00:45 1:00 1:15".split(" ");
$(".autocompleteTime").autocomplete($sessionTimes);

<input type="text" class="autocompleteTime" size="5" />

推荐答案

您必须将minChars设置为0,如下所示:

You have to set minChars to be 0, like this:

$('.autocompleteTime').autocomplete($sessionTimes, {minChars: 0});

还请注意,您不必以$开头变量名,您只需在使用它的任何地方写sessionTimes,就可以了.可能来自PHP背景? :)

Also note that you don't have to start variable name with a $, you could just write sessionTimes everywhere you use it and it would be okay. Probably coming from a PHP background? :)

这篇关于自动完成显示所有选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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