jQuery基于layui開發(fā)。搜索下拉框插件。支持中文、首字母搜索下拉提示列表代碼。
使用方法:
1、head引入css文件
<link rel="stylesheet" type="text/css" href="fonts/iconfont.css">
<link rel="stylesheet" type="text/css" href="layui/css/layui.css">
<!-- 搜索下拉框 -->
<link rel="stylesheet" type="text/css" href="css/ySearchSelect.css">
<style>
.layui-form {
margin-right: 30%;
}
.layui-form-label {
width: 100px;
}
.layui-input-block {
margin-left: 130px;
}
</style>
2、head引入js文件
<script type="text/javascript" src="js/jquery-1.11.3.min.js"></script>
<!--[if lt IE 9]>
<script src="js/html5shiv.min.js"></script>
<script src="js/respond.min.js"></script>
<![endif]-->
<!-- 搜索下拉框 開始 -->
<script src="js/jQuery.Hz2Py-szm-min.js"></script>
<script src="js/ySearchSelect.js"></script>
<!-- 搜索下拉框 結(jié)束 -->
3、body引入HTML代碼
<div class="layui-input-inline">
<div class="layui-form-select ySearchSelect y1">
<div class="layui-input"></div>
<i class="layui-edge"></i>
<ul>
<li class="on" value="id0001">大白菜</li>
<li class="on" value="id0002">土豆</li>
<li class="on" value="id0003">西紅柿</li>
<li class="on" value="id0004">黃瓜</li>
<li class="on" value="id0005">黃花菜</li>
<li class="on" value="id0005">黃花菜1</li>
<li class="on" value="id0005">黃花菜2</li>
<li class="on" value="id0006">恍惚</li>
<li class="on" value="id0007">恍惚是</li>
<li class="on" value="id0005">黃花菜3</li>
<li class="on" value="id0005">黃花菜4</li>
<li class="on" value="id0006">恍惚1</li>
<li class="on" value="id0007">恍惚是2</li>
<p>無匹配項</p>
</ul>
</div>
</div>
<script>
$(function() {
$(".y1").ySearchSelect(); //調(diào)用自定義 高亮插件
})
</script>