convert a JavaScript string variable to decimal/money

后端 未结 7 1178
盖世英雄少女心
盖世英雄少女心 2020-12-07 14:05

How can we convert a JavaScript string variable to decimal?

Is there a function such as:

parseInt(document.getElementById(amtid4).innerHTML)
         


        
相关标签:
7条回答
  • 2020-12-07 14:26
    var formatter = new Intl.NumberFormat("ru", {
      style: "currency",
      currency: "GBP"
    });
    
    alert( formatter.format(1234.5) ); // 1 234,5 £
    

    https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat

    0 讨论(0)
提交回复
热议问题