文件中有js和插件库,导入后调用方法即可
html
<select id="abc"> <option value="jQuery插件库">jQuery插件库</option> <option value="BlackBerry">BlackBerry</option> <option value="device">device</option> ..... </select>
js
$(function() { var x = document.getElementById("abc"); x.selectedIndex = -1; $('select').searchableSelect(); })
select: function(val) { this.element.val(val) var id = $(".searchable-select-item[data-value=" + val + "]") this.selectItem(id); } }); $.fn.searchableSelect = function(options) { return new $sS($(this), options); }; $(function() { $abc = $('select').searchableSelect(); }); function abc() { $abc.select('and'); }回复