版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/cxws110/article/details/88788584
checkbox框:
<table>
<c:forEach items="${fpList}" var="fp">
<tr onclick="dianji('${fp.id}')" >
<td>
<input type="checkbox" name="id" class="pk" id="id_${fp.id}" value="${fp.id}"/>
</td>
</tr>
</c:forEach>
</table>
//点击一行任意位置选中checkbox
function dianji(id){
if($("#id_"+id).prop('checked')==true){//判断状态是否选中
$("#id_"+id).removeAttr("checked");
}else{
$("#id_"+id).attr("checked","checked");
}
}