Jquery获取选中行的某个数据
1.页面结构
<table class="table table-border table-bordered table-bg table-hover table-sort" id="table-list">
<thead>
<tr class="text-c">
<th width="25"><input type="checkbox" id="checkAll" value=""></th>
<th>交易日期</th>
<th>交易类型</th>
<th>交易金额</th>
<th>状态</th>
<th>是否核销</th>
<th>流水来源</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<#list list as item>
<tr class="text-c">
<td width="25"><input type="checkbox" name="checkbox_table" value="${item.id}"></td>
<td>${item.tradeDate1}</td>
<#if item.income==0>
<td>支出</td>
<#else>
<td>收入</td>
</#if>
<#if item.income == 0>
<td>${item.expenditure}</td>
<#else>
<td>${item.income}</td>
</#if>
<#if item.state ==1>
<td>未对账</td>
<#elseif item.state ==2>
<td>对账中</td>
<#else>
<td>已对账</td>
</#if>
<#if item.hxStatus ==0>
<td name="hxStatus">未核销</td>
<#else>
<td name="hxStatus">已核销</td>
</#if>
<#if item.origin == 1>
<td>银行</td>
<#else>
<td>系统</td>
</#if>
<td></td>
</tr>
</#list>
</tbody>
</table>
2.
var a=0;
var Check = $("table input[type=checkbox]:checked");
Check.each(function () {//遍历
var row = $(this).parent("td").parent("tr");//获取选中行
var sname = row.find("[name='hxStatus']").html();
console.log(sname);
if(sname=='已核销'){
console.log(1);
//alert('不能选择已核销的进行绑定');
layer.alert('不能选择已核销的进行绑定', {
icon: 7,
btn: ['确定'],
yes: function(){
refesh();
}
})
a=1;
}
})
if(a==1){
return;
}