Delete table row when user click on row
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js"></script>
<script>
$(document).ready(function() {
$('.deleteRowButton').click(function(){
$(this).parents('tr').first().remove();
})
});
</script>
</head>
<body>
<table>
<tr>
<td><a class="deleteRowButton">Test1</a></td>
</tr>
<tr>
<td><a class="deleteRowButton">Test2</a></td>
</tr>
<tr>
<td><a class="deleteRowButton">Test3</a></td>
</tr>
</table>
</body>
</html>
Most Helpful This Week
jQuery example of scroll to top
Write a function that splits an array into groups the length of size and returns them as a two-dimensional array
How to join string with number in JavaScript?
Check if a string ends with the given target string
jQuery simple form validations between start date and end date
Get largest number from each sub-arrays