Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

141
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda