0
Good morning, you guys!
I have a table that is populated with the data of an XML, and each row of the table has quantity, unit value, ipi and total input. Then I would like that when editing an information in the line the system calculates the Total Product ref. the altered line. Follow the table below to better understand, I need to use javascript for this.
<table width="100%">
<tr>
<th>Produto</th>
<th>Quantidade</th>
<th>Valor Unit.</th>
<th>IPI</th>
<th>Total Produto</th>
</tr>
<tr>
<td>Telha Cimento</td>
<td><input type="txt" id="quantidade" name="quantidade" value="10"></td>
<td><input type="txt" id="valor-unit" name="valor-unit" value="150,00"></td>
<td><input type="txt" id="valor-ipi" name="valor-ipi" value="85,90"></td>
<td><input type="txt" id="valor-total" name="valor-total" value="2.359,00"></td>
</tr>
<tr>
<td>Bloco de Vidro</td>
<td><input type="txt" id="quantidade" name="quantidade" value="5"></td>
<td><input type="txt" id="valor-unit" name="valor-unit" value="55,00"></td>
<td><input type="txt" id="valor-ipi" name="valor-ipi" value="10,90"></td>
<td><input type="txt" id="valor-total" name="valor-total" value="329,50"></td>
</tr>
</table>
I didn’t really know what to do with valueUnit, valueIpi... so I omitted the value in the account. But this is simple to fix.
– Sergio
Can I suggest not generating new arrays from the return of the method
querySelectorAll
? There is no reason why, in this case, the return of querySelectorAll is already an object that has the iterator method (Symbol.iterator), and also its own methodforEach
.– Andre
@user140828 truth, old habits, corrected.
– Sergio