jQuery全选删除

     <div>
    <table id="tab">
    <tr><th>操作</th><th>编号</th><th>封面</th><th>作者</th></tr>
    <tr id="0">
    <td><input type="checkbox" value=0 /></td><td>0</td><td><img src="images/林黛玉.jpg" /></td><td>张三</td>
    </tr>
     <tr id="1">
    <td><input type="checkbox" value=1 /></td><td>1</td><td><img src="images/林心如.jpg" /></td><td>李四</td>
    </tr>
     <tr id="2">
    <td><input type="checkbox" value=2 /></td><td>2</td><td><img src="images/林志玲.jpg" /></td><td>王五</td>
    </tr>
     <tr id="3">
    <td><input type="checkbox" value=3 /></td><td>3</td><td><img src="images/林志颖.jpg" /></td><td>赵六</td>
    </tr>
    </table>
    <table>
     <tr>
     <td>全选<input type="checkbox" id="chkall" /></td><td><input type="button" value="删除"  id="removenode"/></td>
     </tr>
     
    </table>
     <img class="imgclass" id="imgshow" />
    </div>

 

 

 

用jQuery调用

$(function(){

$('#chkall').click(function(){

$('table :checkbox').attr('checked',this.checked);

})

$('#removenode').click(function(){

var ck=$('#form1 :checkbox:not(#chkall)');

ck.each(function (index){

if(this.checked){

$('table tr[id='+this.value+']').remove();

}

 

})

})

})

 

 

 

 

保持初学者的心态!!!!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值