我添加了一个bootstrap行。现在在里面我想添加复选框,这样复选框应该并排显示,而不是像现在一样逐行显示。这是HTML。
<div class="row" id="ReportRow">
<div class="col-md-12">
</div>
</div>
这里是jquery
var Reports = "User, Admin, Detail, Summary";
var arrReportscheckBoxItems = Reports.split(',');
var reportscheckBoxhtml = ''
for (var i = 0; i < arrReportscheckBoxItems.length; i++) {
reportscheckBoxhtml += '<label style="font-weight: 600; color: #00467f !important;"><input type="checkbox" value=' + arrReportscheckBoxItems[i] + '>' + arrReportscheckBoxItems[i] + '</label><br\>';
}
$('#ReportRow').html(reportscheckBoxhtml);
Plesae帮助我正确对齐它。感谢。
答案 0 :(得分:1)
只需从您的代码中删除<br/>
var Reports = "User, Admin, Detail, Summary";
var arrReportscheckBoxItems = Reports.split(',');
var reportscheckBoxhtml = ''
for (var i = 0; i < arrReportscheckBoxItems.length; i++) {
reportscheckBoxhtml += '<label style="font-weight: 600; color: #00467f !important;"><input type="checkbox" value=' + arrReportscheckBoxItems[i] + '>' + arrReportscheckBoxItems[i] + '</label> ';
}
$('#ReportRow > .col-md-12').html(reportscheckBoxhtml);