简体   繁体   English

明确调用jQuery自动完成插件中的自动完成功能

[英]Explicitly calling the autocomplete function in jquery autocomplete plugin

I have a text field to which I have a jquery autocomplete event attached. 我有一个文本字段,上面附加了一个jQuery自动完成事件。 However, due to some reasons, I dont want the search results to appear when the user types, but rather when a button is pressed. 但是,由于某些原因,我不希望在用户键入时出现搜索结果,而是在按下按钮时出现。 I know this sounds lame, but I have my reasons. 我知道这听起来很la脚,但是我有我的理由。 How do I trigger the autosearch results to appear by calling an explicit function? 如何通过调用显式函数来触发自动搜索结果出现?

Not sure what version of autocomplete you are using. 不确定您使用的是哪种版本的自动完成功能。 If you use the latest version which is rolled into jQueryUI you can use the search method: 如果您使用jQueryUI中附带最新版本,则可以使用搜索方法:

Search :: Signature: .autocomplete( "search" , [value] ) 搜索::签名:.autocomplete(“ search”,[value])

Triggers a search event, which, when data is available, then will display the suggestions; 触发搜索事件,当有数据可用时,将显示建议; can be used by a selectbox-like button to open the suggestions when clicked. 单击时可以被类似选择框的按钮用来打开建议。 If no value argument is specified, the current input's value is used. 如果未指定value参数,则使用当前输入的值。 Can be called with an empty string and minLength: 0 to display all items. 可以使用空字符串和minLength:0调用以显示所有项目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM