隐藏

select2的使用 复选

发布:2014/11/7 13:17:34作者:管理员 来源:本站 浏览次数:1633

select2的使用 <wbr>复选
select2的使用 <wbr>复选
<label for="multiSelect" class="control-label">负责人</label>
<div class="controls">
<select class="multiSelect" name="manager" style="width:200px">
<option >tom</option>
<option >admin</option>
<option >alex</option>
</select>
</div>
select2的使用 <wbr>复选
select2的使用 <wbr>复选

<label for="input01" class="control-label" >项目成员</label>
<div class="controls">
<select  name="worker" id="worker" multiple class="multiSelect" style="width:400px">
<option >tom</option>
<option >admin</option>
<option >alex</option>
</select>
</div>
<input type="hidden" name="workers" id="workers"/>
<div class="form-actions">
<button type ="button" id="btnSave"class="btn btn-primary">保存</button>
</div>
javaScript的导入
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/select/select2.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(".multiSelect").select2();
$("#btnSave").click(function(){
var v =$("#worker").select2("val");
$("#workers").val(v);
$("#myform").submit();//myform表单的id
});
});
</script>