想要删除table的某一行的js写法

1  <tr><td onclick="del_tr(this)" >删除</td></tr>
2 // 删除一行 3 function del_tr(obj){ 4 ##obj就是当前对象 this 5 var index = $(obj).parents("tr").index(); //这个可获取当前tr的下标 6 $(obj).parents("tr").remove(); 7 }

猜你喜欢

转载自www.cnblogs.com/pyspang/p/9395930.html