I'm making a sum of all values for a column in a table.
Returning par to html, is being returned without the comma.
How can I make the comma appear in the second house?
var valor_recibo = 0;
$(".valor_recibo").each(function() {
var num = parseInt($(this).text().replace(/[^0-9]/g, ''));
valor_recibo += num;
});
$('#totalrecibo').html(valor_recibo);
The value is returned in a span like this: 25998 Being that the correct form is like this: 259,98
Html Code
<table class="table table-striped m-table m-table--head-bg-success">
<thead>
<tr>
<th>Valor Recibo</th>
</tr>
</thead>
<tbody>
<tr>
<td class="valor_recibo">100</td>
<td class="valor_recibo">200</td>
<td class="valor_recibo">300</td>
<td class="valor_recibo">400</td>
<td class="valor_recibo">500</td>
</tr>
</tbody>
</table>
<div id="totalrecibo"> aqui retorna o valor </div>