jQuery Autocomplete
jQuery Autocomplete
jQuery Autocomplete 外掛根據使用者輸入值進行搜尋和過濾,讓使用者快速找到並從預設值列表中選擇。通過給 Autocomplete 欄位焦點或者在其中輸入字元,外掛開始搜尋匹配的條目並顯示供選擇的值的列表。通過輸入更多的字元,使用者可以過濾列表以獲得更好的匹配。
該外掛現在是 jQuery UI 的一部分,獨立的版本不會再更新了。目前版本是 1.6。
訪問 jQuery Autocomplete 官網,下載 jQuery Autocomplete 外掛。
如需瞭解更多有關 Autocomplete 的細節,請檢視 API 文件 自動完成部件(Autocomplete Widget)。
例項演示
jQuery Autocomplete 外掛演示。
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery UI Autocomplete - Default functionality</title> <link rel="stylesheet" href="https://www.itread01.com//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"> <script src="https://www.itread01.com//code.jquery.com/jquery-1.10.2.js"></script> <script src="https://www.itread01.com//code.jquery.com/ui/1.11.4/jquery-ui.js"></script> <link rel="stylesheet" href="https://www.itread01.com/resources/demos/style.css"> <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 }); }); </script> </head> <body> <div class="ui-widget"> <label for="tags">Tags: </label> <input id="tags"> </div> </body> </html>