我在html中有一个表格如下
- <table>
- <tbody>
- <tr>
- <td>test content</td>
- <td><input type="button" onClick="remove()"></td>
- </tr>
- ....
- ...
- </tbody>
- </table>
解决方法
更好:
- $(this).closest('tr').remove();
- <input type="button" onClick="$(this).closest('tr').remove();">
无论您的单元格中的HTML是什么样子,都可以工作.