-1
habe ich diesen Code die Summe einer Spalte zu bekommen aber es ist nicht richtig BerechnungHinzufügen von Tabellenspalte in Währungsformat
Erwartete Ausgabe: 13.500,00 Aktuelle Ausgabe: 13
Ich denke, das Problem in dem Format der Zahl, aber ich weiß nicht, wie man damit umgeht.
<table id="sum_table" width="300" border="1">
<tr class="titlerow">
<td>Col 1</td>
</tr>
<tr>
<td class="amount">6,000.00</td>
</tr>
<tr>
<td class="amount">1,500.00</td>
</tr>
<tr>
<td class="amount">6,000.00</td>
</tr>
</table>
<div id="total"></div>
<script>
var theTotal = 0;
$(".amount").each(function() {
theTotal += parseInt($(this).html());
});
$("#total").html(theTotal);
</script>
Ihre Antwort ist korrekt, aber wie werde ich es im Währungsformat ausgeben? . –
nicht funktioniert :( –
@ShermaineChaingan: aktualisiert –