-
Notifications
You must be signed in to change notification settings - Fork 0
/
withdraw.js
21 lines (16 loc) · 860 Bytes
/
withdraw.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
document.getElementById('btn-Withdraw').addEventListener('click',function(){
const withdrawField = document.getElementById('withdraw-field');
const withdrawFieldValue = withdrawField.value
const givenBalance = parseFloat(withdrawFieldValue);
const Balance = document.getElementById('withdraw-value');
const withdrawAmountString = Balance.innerText;
const givenAmount = parseFloat(withdrawAmountString);
const showBalance = givenBalance + givenAmount;
Balance.innerText = showBalance ;
const currentBalanceString = document.getElementById('balance-total');
const currentBalancevalue = currentBalanceString .innerText
const currentBalance = parseFloat(currentBalancevalue);
const newBalance = currentBalance - givenBalance;
currentBalanceString.innerText = newBalance;
withdrawField.value ='';
})