标签:
基于jQuery文本框自动联想补全特效。这是一款简单使用的jQuery自动完成插件,可定义索引关键词,可设置输入框的宽高,支持搜索回调函数。效果图如下:
实现的代码。
html代码:
<div id="demo"> <div class="wrapper"> <h3>试试输入"爱编程"</h3> <div id="search-form"></div> <div id="message"></div> </div> </div>
js代码:
var proposals = [‘at‘, ‘boat‘, ‘bear‘, ‘chief‘, ‘dog‘, ‘drink‘, ‘elephant‘, ‘fruit‘, ‘grave‘, ‘hotel‘, ‘illness‘, ‘London‘, ‘motorbike‘, ‘爱编程素材‘, ‘爱编程jquery‘, ‘站长爱编程w2bc.com‘]; $(document).ready(function () { $(‘#search-form‘).autocomplete({ hints: proposals, width: 300, height: 30, onSubmit: function (text) { $(‘#message‘).html(‘Selected: <b>‘ + text + ‘</b>‘); } }); });
Via:http://www.w2bc.com/article/2015-12-01-jquery-input-token-compete
基于jQuery-autocomplete文本框自动联想补全特效
标签:
原文地址:http://www.cnblogs.com/w2bc/p/5102070.html