I have this code :
$(document).ready(function () {
var $entrada = 0,
$saida = 0,
$total = 0;
$.each($("td[name='entrada']"), function() {
$entrada += parseFloat($(this).text().replace(",", "."));
});
$.each($("td[name='saida']"), function() {
$saida += parseFloat($(this).text().replace(",", "."));
});
$total = $entrada - $saida;
$("body").append("TOTAL ENTRADA = R$ " + $entrada + "<br />")
.append("TOTAL SAIDA = R$ " + $saida + "<br />")
.append("TOTAL GERAL = R$ " + $total + "<br />");
});
<body>
<table width="" border="1">
<tr>
<td>ENTRADA</td>
</tr>
</table>
<table width="198" border="1" id="table">
<tr>
<td width="39%">PRODUTO</td>
<td width="12%">VALOR</td>
</tr>
<tr>
<td>1</td>
<td name="entrada">100,00</td>
</tr>
<tr>
<td>2</td>
<td name="entrada">100,00</td>
</tr>
</table>
<p> </p>
<table border="1">
<tr>
<td>SAIDA</td>
</tr>
</table>
<table width="196" border="1">
<tr>
<td width="39%">DESCRICAO</td>
<td width="12%">VALOR</td>
</tr>
<td>SAIDA</td>
<td name="saida">50,00</td>
</tr>
</table>
<p> </p>
</body>
I need sums of total values outside the javascript type inside a table or id div
I know this is for anyone who can handle javascript could anyone help me?