javascript input输入框模糊提示功能详解

js教程评论1.5K views阅读模式

这篇文章主要介绍了javascript input输入框模糊提示功能的实现的相关资料,希望通过本能帮助到大家,需要的朋友可以参考下

javascript input输入框模糊提示功能的实现

主要用到了jQuery.autocomplete函数,定义好一个数组就可以用这个功能了,很方便。

<!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>

效果:

javascript input输入框模糊提示功能详解

以上就是javascript input输入框模糊提示功能详解的详细内容,更多请关注php教程其它相关文章!

企鹅博客
  • 本文由 发表于 2019年7月27日 18:32:00
  • 转载请务必保留本文链接:https://www.qieseo.com/392879.html

发表评论