Bootstrap-select搜索下拉框

1.引入js和css:

    <link href="<c:url value="/resources/lib/bootstrap-select/bootstrap-select.css"/>" rel="stylesheet">

    <script src="<c:url value="/resources/lib/bootstrap-select/bootstrap-select.js"/>"></script>

2.html页面

    <%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<style type="text/css">
.btn-default {
background-color: #FFF;
border-color: #c2c2c2;
color: #000;
}
.btn-default:hover, .btn-default:focus, .btn-default:active, .btn-default.active, .open .dropdown-toggle.btn-default {
background-color: #FFF;
/* border-color: #bababa;*/
color: #000;
}
.bootstrap-select > .dropdown-toggle {
width: 158.5%;
}
.bootstrap-select.btn-group .dropdown-menu {
min-width: 158.5%;
}
</style>
<script type="text/javascript">
function codeChange() {
var wareCode=$('#anmesel_menu3').val();
var rackCode=wareCode+"-";
$("#rackcode").val(rackCode);
}


if($('#rackCodeOne').val()==''){
var wareCode=$('#anmesel_menu3').val();
var rackCode=wareCode+"-";
$("#rackCode").val(rackCode);
}else {
$('#rackCodeOne').val('');
}

</script>

<input id="id" name="id" value="${storageRack.id}" hidden/>
<%--<div class="col-lg-10">
<select class="selectpicker" data-live-search="true">
<option>Mustard</option>
<option>Ketchup</option>
<option>Relish</option>
</select>
</div>--%>

<div class="form-group">
<label class="col-sm-3 control-label" for="anmesel_menu3" style="margin-left: -1.5%;">仓库编码:</label>
<div class="col-sm-8" style="margin-left: 1.7%">
<select id="anmesel_menu3" name="war_id" class="selectpicker" data-live-search="true" οnchange="codeChange()">
<c:forEach items="${warehouseList}" var="warehouse">
<option value="${warehouse.code}"
<c:if test="${warehouse.code == storageRack.war_id}">selected="selected"</c:if>>
${warehouse.code}
</option>
</c:forEach>
</select>
</div>
</div>



<div class="form-group">
<label class="col-sm-3 control-label">货架编码:</label>

<div class="col-sm-8">
<input id="rackcode" name="code" type="text" class="form-control" required value="${storageRack.code}">
<input type="hidden" id="rackCodeOne" name="code" value="${storageRack.code}" />
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">货架名称:</label>

<div class="col-sm-8">
<input id="name" name="name" type="text" class="form-control" required value="${storageRack.name}">
</div>
</div>
<script>
$('.selectpicker').selectpicker('show');
</script>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值