0

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"
        }
})

0 Answers0