Try It Editor
Tip: Press
Ctrl/⌘ + Enter
to Run
▶ Run
Reset
Copy
Download
Code
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Autocomplete minLength</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <link rel="stylesheet" href="https://code.jquery.com/ui/1.13.2/themes/base/jquery-ui.css"> <script src="https://code.jquery.com/ui/1.13.2/jquery-ui.min.js"></script> </head> <body> <p>Type at least 2 characters: <input type="text" id="lang"></p> <script> var languages = ["JavaScript", "PHP", "Python", "Java", "C++"]; $(function(){ $("#lang").autocomplete({ source: languages, minLength: 2 }); }); </script> </body> </html>
Output