+ -
当前位置:首页 → 问答吧 → jquery 新手问题...

jquery 新手问题...

时间:2011-12-05

来源:互联网

$("tr").remove("#k45"); 
想要删除tr id 为k45标签

但是k后面的45是通过 this.id 获取过来的。 我该怎么写?

作者: juenkai   发布时间: 2011-12-05

$("tr #k" + this.id).remove();  

作者: hookee   发布时间: 2011-12-05


removeTr=function(txt){
$(txt).parent().parent().remove();
}

<table>
  <tr>
  <td><input type="button" onclick="removeTr(this)" /></td>
  </tr>
</table>

作者: XiongLi0204   发布时间: 2011-12-05