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

130
Visualizações
What I want is to get the different information of each card to textArea by pressing the correspondent button that have the same class

At the moment, I get all the time the same info which comes from the first card.

const name = document.querySelector(".name").textContent;
const partNumber = document.querySelector(".part-number").textContent;
const price = document.querySelector(".price").textContent;
const textArea = document.querySelector("#message");
let inputQuantity = document.getElementById("quantity");
const buyButton = document.querySelectorAll(".buy-button");


for (let i = 0; i < buyButton.length; i++)
  buyButton[i].addEventListener("click", function () {
    inputQuantity = inputQuantity.value;
    textArea.innerHTML = `I WANT TO BUY
${inputQuantity} ${name}(S)
${partNumber}
${price}

Thank You
`;
  });

to get the information of each card to textArea by pressing the correspondent button.

about 4 years ago · Santiago Trujillo
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