嗨,我需要有关数组列表和选择框的相同帮助 我的代码:
$('#dataa').select2({
placeholder: "dataa",
data: xData,
minimumResultsForSearch: Infinity
});
var xData = [
{
id: 1,
text: '0'
}, {
id: 2,
text: '1'
}, {
id: 3,
text: '2'
}
];
<div class="col-lg-7">
<div runat="server" class="input-group m-input-group">
<select id="dataa" name="dataa" class="form-control m-select2 m-select2-general" style="width:100%">
<option></option>
</select>
</div>
</div>
@if (@ViewBag.mUserAgency == "022047") {
here add to xData item[0] and item[2]
}
我不知道如何添加项目[0]和项目[3]。请帮助我。