元素定位沒問題。
jquery代碼:
$("#dataList .text-center").click(function () {
var id = $("#dataList input[type='hidden']").val();
alert(id);
if (confirm("確定洗掉嗎?")) {
window.location = "${pageContext.request.contextPath}/role/del?id=" + id;
}
});
jsp代碼:
<table id="dataList"
class="table table-bordered table-striped table-hover dataTable">
<thead>
<tr>
<th class="" style="padding-right: 0px"><input
id="selall" type="checkbox" class="icheckbox_square-blue">
</th>
<th class="sorting_asc">ID</th>
<th class="sorting_desc">角色名稱</th>
<th class="sorting">角色描述</th>
<th class="sorting">操作</th>
</tr>
</thead>
<tbody>
<c:forEach var="role" items="${roleList}" varStatus="varstatus">
<tr>
<td><input type="checkbox" ></td>
<td><input type="hidden" value="https://bbs.csdn.net/topics/${role.id}" > </td>
<td>${varstatus.count}</td>
<td>${role.roleName}</td>
<td>${role.roleDesc}</td>
<td class="text-center">
<a href="https://bbs.csdn.net/topics/#" class="btn bg-olive btn-xs" >洗掉</a>
</td>
</tr>
</c:forEach>
</tbody>
</table>
選擇洗掉后,傳的引數Id一直是1.。。。。。。選任何一個洗掉,id都是1

轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/273382.html
標籤:Java EE
上一篇:服務器行程問題,大佬進來看下
下一篇:mybatisplus :int updateById(@Param(Constants.ENTITY) T entity);為什么傳入entity。。
