我不知道为什么,但由于某种原因,当我点击已经检查了其复选框的td时,它不会取消选择它.
$('table tr').click(function() {
checkBox = $(this).children('td').children('input[type=checkbox]');
if(checkBox.attr('checked'))
checkBox.attr('checked', '');
else
checkBox.attr('checked', 'checked');
});
Run Code Online (Sandbox Code Playgroud)
你要:
if(checkBox.attr('checked'))
checkBox.removeAttr('checked');
else
checkBox.attr('checked', 'checked');
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
88 次 |
最近记录: |