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

87
Views
money display won't update

When clicking id="bigButton" It's not updating the amount of money I have. Anyone know why?

var money = 50
    var stickAmount = 0
    var clickValue = 1 + stickAmount
    window.onload = displayMoney();
    function displayMoney() {
        document.getElementById('totalCurrentMoney').innerHTML = "$" + money;
        document.title = "$" + money + " - Arsenal Clicker";
    }
    function click() {
        money = money + clickValue
        displayMoney()
    }
    function purchaseStick() {
        money = money - 50
        stickAmount = stickAmount + 1
        displayMoney()
    }
.card-arangement {
        display: flex;
        justify-content: center;
        gap: 20px;
    }
<div>
    <h1 align="center">Arsenal Clicker</h1>
    <h1 id="totalCurrentMoney" align="center">$5</h1>
    <div class="card-arangement">
        <input type="image" id="bigButton" onclick="click()" src="Images/bigButton.png" height="500">
        <div>
            <input type="image" id="stick" onclick="purchaseStick()" src="Images/stick.png" height="100">
            <input type="text" id="stick" onclick="purchaseStick()" disabled placeholder="stick - $50" height="100">
        </div>
    </div>
</div>

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The function click() is already defined on an input, and gets a higher priority than your method.

So, rename click() function name to updateMoney

<input type="image" id="bigButton" onclick="updateMoney()" src="Images/bigButton.png" height="500">

function updateMoney() {
    money = money + clickValue
    displayMoney()
 }
about 4 years ago · Juan Pablo Isaza Report
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!