【发布时间】:2017-04-05 13:18:51
【问题描述】:
我正在尝试创建一个动态多选下拉菜单。下面的代码不起作用
<div class="form-group">
@Html.Label("Solutions", htmlAttributes: new { @class = "control-label col-md-4" })
<div class="col-md-8">
@Html.DropDownListFor(model => model.SolutionList, new SelectList(new List<SelectListItem>(), "Value", "Text"), new { multiple = "true", @class = "form-control list-group-active-color", Style = "width:100% !important", onchange = "OnGetSolutionsChange(this)" })
@Html.ValidationMessageFor(model => model.SolutionList, "", new { @class = "text-danger" })
</div>
</div>
var solutionOptions = "";
jQuery(result).each(function () {
solutionOptions += "<label><input type='checkbox' name='categories' value='" + this.Value + "'>" + this.Text + "</input></label>";
});
target.append(solutionOptions);
target.multiselect('rebuild')
【问题讨论】:
标签: javascript jquery asp.net-mvc bootstrap-multiselect