I have a table with id=mytabla
, which inside contains several data, and in the last row a field called retentions that should show another table inside, in this I have no problems, staying like this:
<table id="mytabla" class="table table-sm table-striped">
<tbody>
<tr>
<th id="#">#</th>
<th id="Documento" class="tb-gra">Documento</th>
<th id="Fecha">Fecha(emision)</th>
<th id="retenciones">Retenciones</th>
</tr>
<tr>
<td class="tb-neg">1</td>
<td class="tb-gra">FACTURA</td>
<td style="width:64pt">04/06/2018</td>
<td>SIN RETENCION</td>
</tr>
<tr>
<td class="tb-neg">1</td>
<td class="tb-gra">FACTURA</td>
<td style="width:64pt">04/06/2018</td>
<td>SIN RETENCION</td>
</tr>
<tr>
<td class="tb-neg">1</td>
<td class="tb-gra">FACTURA</td>
<td style="width:64pt">04/06/2018</td>
<td>
<table>
<tbody>
<tr>
<td>IVA</td>
<td>3</td>
<td>120.00</td>
<td>100.0</td>
<td>120.00</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
In JavaScript I want to select the table and count the rows, but also tell me those of the second table, how do I not count the second table or not take it into account, I use this code :
var table = document.getElementById("mytabla");
var fila=document.getElementById("mytabla").getElementsByTagName('tr');
var row=table.insertRow(parseInt(fila.length);
var cantidaddefilas=fila.length;
But he is telling me those of the second table, how do I not count those.