2016-03-30 15 views
0

Ich habe eine einfache int wie "77600" Ich möchte es in "77 600" konvertieren (grundsätzlich muss ich ein einfaches Leerzeichen nach Tausenden hinzufügen).Wie konvertiert man zu Geldformat in JS

tmp_total = parseInt(tmp_total,10); //77600 
tmp_total = ...here goes some magic...; 
$('#chekout_total #total').text(tmp_total); 

Antwort

0

versuchen Sie dies:

tmp_total = parseInt(tmp_total,10); //77600 
tmp_total = tmp_total.toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1 '); 
$('#chekout_total #total').text(tmp_total); 

Hoffnung das wird Ihnen helfen! :)

Verwandte Themen