<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
table
{
border-collapse: collapse;
}
td
{
height: 20px;
width: 20px;
border: solid black 1px;
}
.td1
{
height: 20px;
width: 60px;
border: solid black 1px;
background-color: #FF0000;
}
</style>
</head>
<body>
<table>
<tbody>
<tr>
<td></td><td></td><td></td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td class = "td1">1</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td></td><td></td><td></td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td class = "td1">2</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td></td><td></td><td></td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td class = "td1">3</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td></td><td></td><td></td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td class = "td1">4</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td></td><td></td><td></td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td class = "td1">5</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td></td><td></td><td></td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td class = "td1">6</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td></td><td></td><td></td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td class = "td1">7</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td></td><td></td><td></td>
</tr>
</tbody>
</table>
<button>Click</button>
<script>
document.getElementsByTagName('button')[0].addEventListener('click', gggg);
function gggg()
{
let a = document.querySelectorAll('.td1');
let x = a.length;
for (let i = 0; i < x; i++)
{
a[i].parentNode.parentNode.parentNode.remove();
}
}
</script>
</body>
</html>