简体   繁体   English

禁用文本框后,jQuery UI自动完成功能不起作用

[英]JQuery UI autocomplete not working after disabled textbox

Can any one suggest autocomplete is not working after textbox disable and then enable 禁用文本框然后启用后,有人可以建议自动完成功能不起作用吗?

I have one textbox which i type any character and then it populate table below of text box 我有一个文本框,我可以键入任何字符,然后在文本框下方填充表格

like this 像这样

and after i select any value from that it will populate in textbox and after textbox will disabled and focus goes on second textbox on second textbox i have implemented jquery keyup event when i click upkey on second textbox it will redirect to first textbox with enabled which is autocomplete textbox and when i enter one character on textbox autocomplete function is not work, and when i enter second character it is working and populate table. 当我从中选择任何值后,它将填充在文本框中,并且在禁用文本框并将焦点放在第二个文本框的第二个文本框上时,我实现了jquery keyup事件,当我单击第二个文本框上的upkey时,它将重定向到启用的第一个文本框,即自动完成文本框,当我在文本框中输入一个字符时,自动完成功能不起作用,当我输入第二个字符时,它正在工作并填充表格。

what the issue on autocomplete? 自动完成有什么问题?

First of all, you need to provide your basic codes which you are using for enabling and disable the autocomplete. 首先,您需要提供用于启用和禁用自动完成功能的基本代码。 You can check below how to enable and disable. 您可以在下面检查如何启用和禁用。

 <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>jQuery UI Autocomplete - Default functionality</title> <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> <link rel="stylesheet" href="/resources/demos/style.css"> <script src="https://code.jquery.com/jquery-1.12.4.js"></script> <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> <script> $( function() { var availableTags = [ "ActionScript", "AppleScript", "Asp", "BASIC", "C", "C++", "Clojure", "COBOL", "ColdFusion", "Erlang", "Fortran", "Groovy", "Haskell", "Java", "JavaScript", "Lisp", "Perl", "PHP", "Python", "Ruby", "Scala", "Scheme" ]; $( "#tags" ).autocomplete({ source: availableTags }); $("#disable").click ( function() { $( "#tags" ).autocomplete({ disabled: true }); }); $("#enable").click ( function() { $( "#tags" ).autocomplete({ disabled: false }); }); } ); </script> </head> <body> <div class="ui-widget"> <label for="tags">Tags: </label> <input id="tags"> </div> <br> <button id="disable">disable</button> <button id="enable" >enable</button> </body> </html> 

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

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