dwz的talbe样式不同,决定能不能用js

dwz的talbe样式不同,决定里面的元素能不能用js

<div class="tableList" layoutH="60">

<table class="table" width="100%">

<thead>

<tr>

   <th><input type="checkbox" group="ids" class="checkboxCtrl"></th>

<th>编码</th>

<th>姓名</th>

<th>电话</th>

<th>邮箱</th>

<th>角色</th>

<th>备注</th>

</tr>

</thead>

<tbody>

<c:forEach var="item" items="${list.list}" varStatus="s">

<tr target="slt_objId" rel="${item.id}" class="class_tr">

   <td><input name="ids" type="checkbox" value="${item.id}"></td>

<td>${item.code}</td>

<td>${item.name}</td>

<td>${item.telephone}</td>

<td>${item.email}</td>

<td>

<c:forEach var="r" items="${item.opmRole}" varStatus="e">

${r.name}

</c:forEach>

</td>

<td>${item.memo}</td>

</tr>

</c:forEach>

</tbody>

</table>

</div>

 

 

<div class="tableList" layoutH="60">

<table class="list" width="100%">///////为list的时候才会脚本对其有用

<thead>

<tr>

   <th><input type="checkbox" group="ids" class="checkboxCtrl"></th>

<th>编码</th>

<th>姓名</th>

<th>电话</th>

<th>邮箱</th>

<th>角色</th>

<th>备注</th>

</tr>

</thead>

<tbody>

<c:forEach var="item" items="${list.list}" varStatus="s">

<tr target="slt_objId" rel="${item.id}" class="class_tr">

   <td><input name="ids" type="checkbox" value="${item.id}"></td>

<td>${item.code}</td>

<td>${item.name}</td>

<td>${item.telephone}</td>

<td>${item.email}</td>

<td>

<c:forEach var="r" items="${item.opmRole}" varStatus="e">

${r.name}

</c:forEach>

</td>

<td>${item.memo}</td>

</tr>

</c:forEach>

</tbody>

</table>

</div>

 

 

<script type="text/javascript">

$(".class_tr").on('click', function() {

var inputcheckbox = $(this).find("input");

if (inputcheckbox.attr("checked") == "checked") {

inputcheckbox.removeAttr("checked");

inputcheckbox.prop('checked',false);

} else {

inputcheckbox.attr("checked", "checked");

inputcheckbox.prop('checked',true);

}

});

</script>

你可能感兴趣的:(dwz的talbe样式不同,决定能不能用js)