搜索提示jQuery插件:Autocomplete.js
jopen
10年前
Autocomplete.js是jQuery插件,改善与提示搜索。 Autocomplete.js也有一些选项来定制。
1. 填写提示和调用插件在选择的HTML元素上。
var words = ['boat', 'bear', 'dog', 'drink', 'elephant', 'fruit']; $(document).ready(function(){ $('#yourElement').autocomplete( hints: words ); });
Options
- hints: words array for displaying hints
- placeholder: search input placeholder (default: 'Search')
- width: input text width
- height: input text height
- showButton: display search button (default: true)
- buttonText: button text (default: 'Search')
- onSubmit: function handler called on input submit
- onBlur: function handler called on input losing focus