This article mainly introduces the relevant information about the implementation of the fuzzy prompt function of the javascript input input box. I hope it can help everyone through instinct. Friends in need can refer to the following
javascript input input box fuzzy prompt The implementation of the function
mainly uses the jQuery.autocomplete function. You can use this function after defining an array, which is very convenient.
<!doctype html> <html> <head> <meta charset="utf-8"> <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css" rel="external nofollow" > <script src="//code.jquery.com/jquery-1.10.2.js"></script> <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script> <script> $(function() { var availableTags = [ "James", "Kobe", "Jordan" ]; $( "#tags" ).autocomplete({ source: availableTags }); }); </script> </head> <body> <p class="ui-widget"> <label for="tags">Tags: </label> <input id="tags"> </p> </body>
Effect:
The above is the detailed content of Detailed explanation of fuzzy prompt function of javascript input input box. For more information, please follow other related articles on the PHP Chinese website!