input输入框模糊提示功能

来源:互联网 发布:字体管家mac版下载 编辑:程序博客网 时间:2024/04/28 04:05

主要用到了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">  <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><div class="ui-widget">  <label for="tags">Tags: </label>  <input id="tags"></div></body>

效果:

这里写图片描述

0 0