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

137
Visualizações
my Javascript button doesn't work when I upload the extension to Google chrome

The button works alright on my code editor but when I upload the whole package to chrome extensions the function doesn't fire.

here's the js:

const netProfit = document.getElementById("netprofit")
const btn = document.querySelector("button")
const gg = document.getElementById("gg")
 
btn.addEventListener("click", function() {
    const buyPrice = document.getElementById("buyprice").value
    const sellPrice = document.getElementById("sellprice").value
    const royalty = document.getElementById("royalty").value
    const serviceFee = document.getElementById("servicefee").value
    const buyGas = document.getElementById("buygas").value
    const sellGas = document.getElementById("sellgas").value
    const img = document.querySelector("img")
    let profitCal = ((100 - royalty - serviceFee) * 0.01) 
    profitCal = (sellPrice * profitCal) - buyPrice - buyGas - sellGas
    //no annoying 0.0000
    if (profitCal != 0) {
    netProfit.textContent = profitCal.toFixed(5)
    } else {
    netProfit.textContent = profitCal
    }
        if (profitCal >= 0.1) {
        img.style.display = "block"
        } else {
        img.style.display = "none"
        }
})

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