chosen插件下载及使用教程:https://harvesthq.github.io/chosen/
下载后
在html文件中引用
<link rel="stylesheet" href="../../static/chosen.css">
<script src="../../static/chosen.jquery.js"></script>
给select标签加上类area-select
<select name="type" id="" class="form-control area-select" style="width: 100%;" >
<option value="0" >分类</option>
<option value="1" >分类2</option>
</select>
如果option数据是动态生成的,则在数据生成后,加上这二行代码,就可以同步更新插件的下拉框。
$('[name=type]').trigger('chosen:updated');//更新select中的chosen插件
$('[name=type]').chosen();