如何获取jQuery自动完成功能以弹出字段焦点? [英] How to get jQuery Autocomplete to pop up on field focus?

查看:76
本文介绍了如何获取jQuery自动完成功能以弹出字段焦点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
jQuery自动完成UI-我希望它无需用户输入任何内容即可开始进行焦点搜索

Possible Duplicate:
jQuery autocomplete UI- I'd like it to start the search onfocus without the user having to type anything

jQuery UI自动填充

我希望输入集中后立即显示选项.有这个设置吗?我尝试将minLength设置为0,但不起作用...它仍在等待按键.

I want the options to appear as soon as my input is focused. Is there a setting for that? I tried setting minLength to 0, but it doesn't work... it still waits for a keypress.

推荐答案

$("#yourField").bind('focus', function(){ $(this).autocomplete("search"); } );

这里是jsfiddle: http://jsfiddle.net/fpHf4/2/ 更新了一个(针对IE): http://jsfiddle.net/q9ERL/4/

Here a jsfiddle: http://jsfiddle.net/fpHf4/2/ Updated one (for IE): http://jsfiddle.net/q9ERL/4/

由@HoldOffHunger启发,您还必须将minLength设置为0

As enlighted by @HoldOffHunger you must also set minLength to 0

这篇关于如何获取jQuery自动完成功能以弹出字段焦点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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