jQuery 怎么获取表格里面的值
源码:
<div class="title_c">
<h3 class="title_right2">
人员列表
</h3>
<a class="btn_small f_right mright10" href="#"><b
class="add_select"></b>批量导入</a><a
class="btn_small f_right mright10"
onclick="showpop('del')"><b class="del"></b>删除</a>
<!-- onclick="showpop('add_p')" -->
<a class="btn_small f_right mright10" id="edit"><b class="edit"></b>修改</a>
<a class="btn_small f_right mright10"
onclick="showpop('add_p')"><b class="add"></b>新增</a>
</div>
<div class="mtop10">
<div class="over_x_sco">
<table width="100%" cellpadding="0" cellspacing="1"
class="table_list3 table_border_line evenRow">
<tr class="background_th">
<th align="center">
<input type="checkbox" name="checkbox4" id="checkbox4" />
</th>
<th>
序
</th>
<th>
员工编号
</th>
<th>
姓名
</th>
<th>
集采供应商标识
</th>
<th>
手机
</th>
<th>
国籍
</th>
<th>
性别
</th>
<th>
所在组
</th>
<th>
有效起始日期
</th>
<th>
有效终止日期
</th>
</tr>
<s:iterator value="pm.rows" var="emp" status="ss">
<tr>
<td align="center" valign="middle">
<input type="checkbox" name="checkbox5" id="checkbox5" />
</td>
<td>
<s:property value="#ss.count"/>
</td>
<td>
<s:property value="#emp.id"/>
</td>
<td>
<s:property value="#emp.empName"/>
</td>
<td>
<s:property value="#emp.supplierId"/>
</td>
<td>
<s:property value="#emp.mobile"/>
</td>
<td>
<s:property value="#emp.country"/>
</td>
<td>
<s:property value="#emp.sex"/>
</td>
<td>
<s:property value="#emp.group"/>
</td>
<td>
<s:date name="#emp.startDate" format="yyyy-MM-dd"/>
</td>
<td>
<s:date name="#emp.endDate" format="yyyy-MM-dd"/>
</td>
</tr>
</s:iterator>
</table>
</div>
function Edit() {
$('table tr:gt(0) input:checked').each(function () {
var tr = $(this).closest('tr'), td = tr.find('td:gt(0)');
td.each(function () {alert(this.innerHTML) });
})
}
<script type="text/javascript">
$("#edit").bind("click",function(){
var cblist = $(".checkbox5[checked=true]");
if (cblist < 1){
alert("请先选中再操作");
}
cblist.each(function(){
var tr = $(this).parent().parent();
//找到了这行记录,依次用find去找子元素的值
});
});
</script>