使用方法:
1、head引入js文件
<script src="js/jquery.min.js"></script>
2、body引入HTML代码
<div> <h5>单选</h5> <select name="search" id="search" data-selector> <option value="">请选择</option> </select> </div> <div> <h5>多选</h5> <select name="searchs" id="searchs" data-selector data-selector-checks="true"> <option value="">请选择</option> </select> </div> <script src="js/area.js"></script><!--所有城市数据--> <script src="js/select.js"></script><!--默认调用方法--> <script src="verSelector/verSelect.js"></script><!--封装插件--> <script> new verSelector(); //启动插件 </script>
3、设置单选和多选
select属性添加单选:data-selector
select属性添加多选:data-selector data-selector-checks="true"