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

207
Views
La cantidad del valor de Javascript no cambia

El problema es que cuando presiono el botón "depositar", la función "depositar dinero" debería ejecutarse y agregar la cantidad deseada al saldo actual. Sin embargo, no hace eso y el saldo permanece en $0.

 // Variable declarations let balance = document.getElementById("balance"); let balanceAmount = 0; let depositInput = 0; depositInput = document.getElementById("depositAmount").value; let depositButton = document.getElementById("depositButton"); // Cash amount let cash = document.getElementByIJd("cash") let cashAmount = 1000; // Draw on screen balance.innerHTML = "$" + balanceAmount; cash.innerHTML = "$" + cashAmount; // This function runs through onclick in the html document function depositMoney() { balanceAmount = balanceAmount + depositInput; balance.innerHTML = "$" + balanceAmount; }
 <div class="atm-deposit"> <input type="text" name="Deposit Amount" id="depositAmount"> <input type="button" value="Deposit" id="depositButton" onclick="depositMoney()"> </div>
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!