Home  >  Article  >  Web Front-end  >  Detailed explanation of fuzzy prompt function of javascript input input box

Detailed explanation of fuzzy prompt function of javascript input input box

巴扎黑
巴扎黑Original
2018-05-15 14:36:422496browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn