<c:forEach>循环列表,获取勾选的checkbox中某个<td>的值

<table>
    <!--列表表头 开始 -->
    <tr>
        <th><input type="checkbox" name="checkbox" id="checkAll"/></th>
        <th>序号</th>
        <th>姓名</th>
        <th>性别</th>
        <th>身高</th>
        <th>体重</th>
        <th>学校</th>
        <th>城市</th>
    </tr>
    <!--列表表头 结束 -->
    <!-- 数据行 开始 -->
    <c:forEach var="li" items="${resultList}" varStatus="status">
    <tr>
        <td><input type="checkbox" name="checkedId" value="${li.id}" id="${li.id}"/></td>
        <td>status.index+1</td>
        <td>name</td>
        <td>sex</td>
        <td>height</td>
        <td>weight</td>
        <td>school</td>
        <td>city</td>
    </tr>
    </c:forEach>
    <!-- 数据行 结束 -->
</table>
 $('input:checkbox:checked').each(function(){
    name = $('input[type=checkbox]:checked').closest('tr').find('td:eq(2)').map(function(){return this.innerHTML}).get().join();
    school = $('input[type=checkbox]:checked').closest('tr').find('td:eq(6)').map(function(){return this.innerHTML}).get().join();
});

猜你喜欢

转载自www.cnblogs.com/xueyicanfei/p/10270359.html