0
我有这个表,从中我想选择所有的td
元素值,如果复选框是checked
,然后把所有的元素在一些数组或字符串,这样我可以转移它到服务器端。选择td元素复选框是
<table id="tableDg">
<tbody>
<tr>
<td><input type="checkbox" class = "chkbCsm" ></input></td>
<td width="10%" align="center"> <input type="hidden" id="nameText" readonly="true" value="{name}">{name}</input></td>
<td width="22%" align="center"> <input type="hidden" id="nameText" readonly="true" value="{host}">{host}</input></td>
</tr>
</tbody>
</table>
下面是我在做什么jQuery的一面,但不管做选择的事情复选框的正对。请有人帮我解决一些问题。
$('#tableDg tbody tr').live('click', function (event) {
$(this).find('td').each(function(index, item) {
if ($(this).has(':hidden')) {
alert($(this).find(':hidden').val());
}
});
});
新增一个的jsfiddle链接
看看here