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

184
Visualizações
Im having trouble with changing the value of button
async function invoiceToHTMLRow(invoice) {
  // let balance = await Balance(Invoice.invoiceNo)
  //   console.log('this',balance)
    return `<tr> 
<td> ${invoice.customerId} </td>
<td id ='invNo'> ${invoice.invoiceNo} </td>
                 <td> ${invoice.amount} </td>
                  <td> ${invoice.customerName} </td>
                  <td> ${invoice.invoiceDate} </td>
                  <td> ${invoice.dueDate} </td>
                  <td> ${await Balance(invoice.invoiceNo)} </td>     
    </td>
                 <td>
                     <i class = "fa-Balance"onclick="showBalance('${invoice.invoiceNo}')" > Balance </i>

<i class = "fa-fa-edit"onclick="updateInvoice('${invoice.invoiceNo}')" > Edit </i>
<i class="fa-trash" onclick="deleteInvoiceFromTable('${invoice.invoiceNo}')"> Delete </i>
</td>
   </tr>`
    async function showBalance(invoiceNo) {
        const invoice = await repo.getInvoiceByNo(parseInt(invoiceNo))
        const number = document.querySelector('#invNo').value = invoice.invoiceNo
        const BTN =  document.getElementById('balanceBtn');
        BTN.innerHTML = `${await Balance(number)}` 
    }
      

so on my html page i get 3 balance buttons but when i click on one of them the value of the first button changes even if i clicked on the other ones [1]: https://i.stack.imgur.com/Az79C.png how to target the button that i clicked on? ty

about 4 years ago · Juan Pablo Isaza
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