<dl class="equp_dl clear">
<dt>管辖建筑:</dt>
<dd>
<c:if test="${!empty userBaseInfo_jg}">
<p>${userBaseInfo_jg.fanhuiCount}</p>
<c:forEach items="${list}" var="organization">
<c:if test="${!empty organization.buildName}">
<p><input type="checkbox" name="s9" value="${organization.id}" />${organization.buildName}</p>
</c:if>
</c:forEach>
</c:if>
</dd>
</dl>
JS实现
<script>
$(function(){
var boxObj = $("input:checkbox[name='s9']"); //获取所有的复选框
var expresslist = '${userBaseInfo_jg.s9}';
var express = expresslist.split(','); //去掉它们之间的分割符“,”
$.each(express, function(index, expressId){
boxObj.each(function () {
if($(this).val() == expressId) { //判断如果boxObj取到的数据 == expressId
$(this).attr("checked",true); //checkBox显示
}
});
});
})
</script>