Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

114
Visualizações
Displaying javascript calculated variable output as currency

I currently have a variable that is made up of two calculated variables. How ever I need to display the outputted variable as a currency which includes thousand separators.

In this instance, the user inputs the width and length of a room and then the java calculates and tells the user how much the required quantity will be. I will add my code below to help see how this is currently working.

All help would be greatly appreciated. Thanks

Here is the calculation variable:

$price = ($quantity_needed*pricePerTile);
$('#ft-price-res').text("£"+$price.toFixed(3));

The full javascript for this page you can view here: https://jsfiddle.net/3yw4m7kj/

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

e.g.:

$('#ft-price-res').text(Intl.NumberFormat('en-GB', {
   style:'currency', 
   currency:'GBP', 
   minimumFractionDigits:3
}).format($price));

and fairly safe to use : https://caniuse.com/?search=Intl.NumberFormat

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda