Home >Web Front-end >JS Tutorial >JavaScript code implements the fuzzy prompt function of the input input box
This article mainly introduces to you the relevant information about the implementation of the fuzzy prompt function of the javascript input input box. I hope it can help you through instinct. Friends in need can refer to it. I hope it can help everyone.
Realization of the fuzzy prompt function of the javascript input input box
Mainly uses the jQuery.autocomplete function. You can use this function after defining an array. It 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:
Related recommendations:
input tag Input box with prompt text method
Vue implements an example tutorial of splitting mobile phone numbers in a numeric input box
The above is the detailed content of JavaScript code implements the fuzzy prompt function of the input input box. For more information, please follow other related articles on the PHP Chinese website!