jquery 做table多选删除 添加 表格

我的代码是
<script src="jquery-1.8.0.min.js"></script>
</head>
<body>
<table border=1><tr><td><input type='checkbox'/>id</td><td>姓名</td><td>年龄</td><td>性别</td></tr></table>
<input type="button" value="添加" class="tianjia" />
<input type="button" value="删除" class="shanchu" />
<script>

$(function() {
$('.tianjia').click(function() {
var a="<tr><td><input type='checkbox'/></td><td>1</td><td>1</td><td>1</td></tr>";
$('table').append(a);
});
});
$(function() {
$('.shanchu').click(function() {
$(':checkbox').each(function(no) {
if($(":checkbox:eq("+no+")").attr('type')=='checkbox'){
if($(":checkbox:eq("+no+")").attr('checked')){
$(this).parent().parent().remove();
}
};
});

});
});

</script>
</body>
</html>
为什么我一次删除不完?请问怎么解决?

$('.shanchu').click(function() {
        $(':checkbox').each(function(no) {    
           if($(this).attr('type')=='checkbox'){ 
             if($(this).attr('checked')){
               $(this).parent().parent().remove();
             }
           };
        });
        
    });

温馨提示:答案为网友推荐,仅供参考