HTML:
<table id="list"> <tr> <td><input type="checkBox" checked="true"></td> <td>...</td> </tr> <tr> <td><input type="checkBox" checked="true"></td> ... </tr> ... </table>
JS:
$('#list tr').each(function(){ console.log( $(this).find('input[type="checkBox"]').is(':checked') ); });
问题:上面的日志语句总是返回true.每个tr都包含一些数据,我想使用这些数据执行操作.但是用户可以取消选择某些实体,在这种情况下这是不可能的,因为is(‘:checked’)总是返回true,即使取消选中/取消选中该条目也是如此.
任何想法如何解决这一问题?