JS

2016-03-30 20 views
0

nasıl para biçimine dönüştürebilirim "77600" gibi basit bir int'ye sahip olmak istiyorum "77 600" e dönüştürmek istiyorum (temelde binlerce sonra basit bir boşluk eklemek gerekir).JS

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

cevap

0

bu deneyin:

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); 

Umut bu size yardımcı olacaktır! :)