直播平台搭建源码,multiple-select 单选框多选框的用法
<div class="row">
<div class="col-sm-11">
<div class="input-group">
<span class="input-group-addon">
角色:
</span>
<div class="form-group">
<select multiple="multiple" id="selectRoles
name="rolesSelect"></select>
<input name="roles" id="rolesSelect" hidden/>
</div>
</div>
</div>
</div>
首先动态获取下拉框
function initRole() {
$.post(ctx + "role/list", {}, function (r) {
var data = r.rows;
var option = "";
for (var i = 0; i < data.length; i++) {
option += "<option value='" + data[i].roleId + "'>" + data[i].roleName + "</option>"
}
$rolesSelect.html("").append(option);
var options = {
selectAllText: '所有角色',
allSelected: '所有角色',
width: '100%',
onClose: function () {
$roles.val($rolesSelect.val());
validator.element("input[name='roles']");
}
};
$rolesSelect.multipleSelect(options);
});
}
以上就是直播平台搭建源码,multiple-select 单选框多选框的用法, 更多内容欢迎关注之后的文章
标签:multiple,单选框,rolesSelect,源码,var,select,选框 From: https://www.cnblogs.com/yunbaomengnan/p/17525587.html