jQuery刪除當前行,只需傳this,即可:
</pre><p><tr><td><input type='hidden' name='annex' value="+rs+">
<a href='javascript:void(0);' onclick=\"download('"+rs+"')\">"+rs+"</a>
<span onclick='deleteTr(this);' style='cursor:pointer'> 刪除</span></td></tr> </p>
<pre code_snippet_id="1684775" snippet_file_name="blog_20160516_7_63040" name="code" class="html">
//刪除當前行
function deleteTr(nowTr){
//多一個parent就代表向前一個標簽,
// 本刪除范圍為<td><tr>兩個標簽,即向前兩個parent
//如果多一個parent就會刪除整個table
$(nowTr).parent().parent().remove();
}
以上就是小編為大家帶來的jquery刪除table當前行的實例代碼全部內容了,希望大家多多支持~