Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

140
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!