checkbox的选中问题,数据库中和页面中的相比较显示
var rId = [];
var chk_value = [];
var data1 = "";
var data2 = "";
for ( var i = 0; i < chk_value.length; i++) {
data1 = chk_value[i];
for ( var j = 0; j < rId.length; j++) {
data2 = rId[j];
if (data1 == data2) {
$('input[name="checkbox"]')[i].checked="true";
}
}
}
<#list listrole as list>
<div class="ListItem" >
<div class="ListItemContent" style="width: 90%">
<div class="NodeNameIcon" style="position: relative">
<img src='images/action.gif' />
</div>
<div class="NodeNameText" style="position: relative">
${list.roleName!}
</div>
</div>
<div class="ListItemContent" style="width: 8%" align="right">
<input type="hidden" id="id"/>
<input type="hidden" id="cid"/>
<input type="checkbox" name="checkbox" value="${list.roleId}" >
</div>
</div>
</#list>
<#list role as role>
<input type="hidden" value="${role.id!}" id="id">
<input type="hidden" value="${role.roleId}" id="rid" name="rid">
</#list>