<div class="banks">
<div class="banks__tinkoff">
<div class="form">
<input
class="tinkoff__input"
type="number"
name="bankTinkoff"
placeholder="14000.00"/>
<label for="tinkoff"><img src="/img/tinkoff.svg" alt="логотип банк" width="80"/></label>
</div>
<div class="banks__alfa">
<input
class="alfa__input"
type="number"
name="bankAlfa"
placeholder="10000.00"/>
<label for="alfa"><img src="/img/Alfa-Bank.svg" alt="логотип банк" width="80"/></label>
</div>
<div class="banks__rosbank">
<input
class="rosbank__input"
type="number"
name="bankrosbank"
placeholder="5000.00"/>
<label for="rosbank"><img src="/img/rosbank.svg" alt="логотип банк" width="80"/></label>
</div>
<div class="banks__btn">
<p>Сумма : <span class="result"></span></p>
<button class="btn">Посчитать</button>
<input class="clear-btn" type="reset" value="Очистить" />
</div>
</div>
</div>
</div>
let btnElement = document.querySelector(".btn");
let resultElement = document.querySelector (".result");
let clearBtn = document.querySelector('.clear-btn');
let tNumber = document.querySelector('[name="bankTinkoff"]');
let aNumber = document.querySelector('[name="bankAlfa"]');
let rNumber = document.querySelector('[name="bankrosbank"]');
btnElement.addEventListener("click", () => {
if(tNumber.value === '' || aNumber.value === '' || rNumber.value === ''){
resultElement.textContent = 'Заполните все поля';
}
else{
let res = parseFloat(tNumber.value) + parseFloat(aNumber.value) + parseFloat(rNumber.value);
resultElement.textContent = res;
}
})
clearBtn.addEventListener('click', () => {
resultElement.textContent = '';
tNumber.value = undefined;
aNumber.value = undefined;
rNumber.value = undefined;
})