You need to give the closest
function a selector. Try this:
$('.btnClass').click(function() {
$(this).closest('tr').remove();
});
Also, your HTML is invalid as th
should be a child of tr
:
<table class='tableClass'>
<tbody>
<tr>
<th>Text</th>
<th>Text</th>
<th>Text</th>
</tr>
<tr>
<td>Text</td>
<td>Text</td>
<td>
<button type='button' class='btnClass'>Delete</button>
</td>
</tr>
<tr>
<td>Text</td>
<td>Text</td>
<td>
<button type='button' class='btnClass'>Delete</button>
</td>
</tr>
<tr>
<td>Text</td>
<td>Text</td>
<td>
<button type='button' class='btnClass'>Delete</button>
</td>
</tr>
</tbody>
</table>