I'm trying to make a basic wallet program that will have my current value listed on the top. Whatever number that's put into the form, is then submitted which should hopefully then readjust the total to the new amount. Fairly straightforward and I feel like I am so close, but I just can't figure out what's missing.
It doesn't seem to be taking the data from the first input and running it through the function, maybe I need an ACTION? I've tried action, and even using new currentCash but it's not working ... could really use some help. Thanks so much!
<html>
<head>
<title>My Wallet</title>
<script type="text/javascript">
currentCash = 40000;
function deductFromTotal(){
var spent = document.getElementById("money_spent");
currentCash -= spent;
return currentCash; }
</script>
</head>
<body>
<h2>Current total is: <script type="text/javascript">
document.write(currentCash);
</script> </h2>
<input type="amount" size= 25 Placeholder="How much did you spend today?" ID="money_spent" >
<input type="button" value= "confirm" onClick="deductFromTotal()">
</body>
</html>