简体   繁体   English

自动完成功能在按键功能中不起作用

[英]autocomplete not working in keydown function

I have retrieved data from local database while typing in textbox using keydown function in jquery. 我在jquery中使用keydown函数在文本框中键入内容时已从本地数据库检索数据。 I want to show that data's using jquery autocomplete.But autocomplete works fine in onload not in keydown function. 我想证明数据使用的是jQuery自动完成功能,但是自动完成功能可以在onload而不是在keydown函数中正常工作。

how to do that? 怎么做?

You better read the Autocomplete UI docs. 您最好阅读自动完成UI文档。 You don't need to attach autocomplete event to keydown, the plugin will do it for you. 您不需要将自动完成事件附加到keydown,插件将为您完成。 You just have to invoke Autocomplete on the texbox with the required parameters. 您只需要使用所需的参数在texbox上调用Autocomplete。

You do not need to manually handle any events when using the jQuery UI autocomplete plugin. 使用jQuery UI自动完成插件时,您无需手动处理任何事件。 That's the point of the plugin. 这就是插件的重点。

$('#idOfYourTextbox').autocomplete({
    source: yourDataSource
});

If you're having a more specific problem with the plugin, add that information to your question so we can help you further. 如果您在使用插件时遇到了更具体的问题,请将该信息添加到您的问题中,以便我们进一步为您提供帮助。 If you need more information about the plugin, see the documentation . 如果您需要有关插件的更多信息,请参见文档

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

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