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

156
Visualizações
How to keep track of a purchase total based on number of clicks

I am trying to keep track of a running total based on number of clicks on the buttons on the site. There are 8 buttons, all of which should add $123.45 to the total when clicked, as well as alert the total.

Some of my HTML

<article class="dog-card">
  <img src="images/murphy-card.jpg" alt="a brown and white dog with a questioning look on his face" onclick="dogInfo('Murphy', 'Mix', '$123.45')">
  <h3>Murphy</h3>
  <p><strong>Cost to Adopt:</strong> $123.45</p>
  <p>Corrum volorit iandae nimaxim cum restia volor reicid ut et etur sunt arum rendae pla endis re ea erum, qui doluptae</p>
  <p class="adopt" onclick="addFee()">Adopt</p>
</article>

And my JS so far

function addFee() {
  let x = 123.45;
  let total = ('Your total is $' + x);

  alert(total);
}

I know this JS isn't what I need, but I just wanted to put something in so I could verify the button was working.

Any advice is much appreciated, thanks!

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

0

let LastTotal = 0;

function addFee() {
  lastTotal = lastTotal + 123.45;
  alert("Your total is $" + lastTotal);
}

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