Propiedad tBodies
La propiedad tBodies almacena un array de todos los
tbody
de la tabla (puede haber varios).
Sintaxis
tabla.tBodies;
Ejemplo
Obtengamos y recorramos en un ciclo todos los tbody de la tabla:
<table id="table">
<thead>
<tr>
<th>header1</th>
<th>header2</th>
<th>header3</th>
</tr>
</thead>
<tbody>
<tr>
<td>value</td>
<td>value</td>
<td>value</td>
</tr>
<tr>
<td>value</td>
<td>value</td>
<td>value</td>
</tr>
</tbody>
<tbody>
<tr>
<td>value</td>
<td>value</td>
<td>value</td>
</tr>
<tr>
<td>value</td>
<td>value</td>
<td>value</td>
</tr>
</tbody>
</table>
let table = document.querySelector('#table');
for (let tBody of table.tBodies) {
console.log(tBody);
}