The problem is, that when I press the "deposit" button, the function "depositMoney" should run and add the desired amount to the current balance. However, it does not do that and the balance stays at $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>