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

172
Visualizações
how do i properly assign a price, then calculate price by quantity? javascript

(the javascript is in a separate file for tidy purposes)

this is my first time posting a question

im learning to create a website, i have multiple inputs in the html. I also want to output the total for both individually and as well as all together in an estimate within the bottom of the website.

individually ItemPrice * Quantity;

all together = total price;

hope this makes sense??## Heading ##


 // Calculating Function for Tier3
function price(Tier3) {
    var Tier1 = document.getElementById("Tier3");//Getting ID
    Tier3 = 1.4;

    var Tier1 = document.getElementById("Tier2");//Getting ID
    Tier2 = 1.6;

    var Tier1 = document.getElementById("Tier1");//Getting ID
    Tier1 = 1.8;

    var RAM = document.getElementById("RAM");//Getting ID
    RAM = 3.45; //assigning value

    var vCPU = document.getElementsByID("vCPU"); //Getting ID
    vCPU = 2.54; // assigning price?

    var price = parseFloat($('#price').text()) || 0;
    var qty = parseInt($('#quantity').val());
    var total = price * qty;
    $('#total').text(total);

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

0

i figured it out, thanks guys!
// Calculating Function for Tier3 function price() {

var Tier3 = document.getElementById("Tier3");//Getting ID
//Tier3 = 1.4;

var Tier2 = document.getElementById("Tier2");//Getting ID
//Tier2 = 1.6;

var Tier1 = document.getElementById("Tier1");//Getting ID
//Tier1 = 1.8;

var RAM = document.getElementById("RAM");//Getting ID
//RAM = 3.45; //assigning value

var vCPU = document.getElementById("vCPU"); //Getting ID

var totalPerItem = document.getElementById("totalPerItem")

totalPerItem.innerHTML = "$" + ((vCPU.value * 2.54) + (RAM.value * 3.45) + (Tier1.value * 1.8) + (Tier2.value * 1.6) + (Tier3.value * 1.4)); // assigning price?

}

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