Код: Выделить всё
if (billValue.value < 1) {
tipAmountValue.innerText = "$0.00";
totalAmountValue.innerText = "$0.00";
billErrorText.style.display = "block";
billValueBox.classList.add("error");
} else {
billErrorText.style.display = "none";
billValueBox.classList.remove("error");
}
if (custom == true && customTip.value < 1) {
tipAmountValue.innerText = "$0.00";
totalAmountValue.innerText = "$0.00";
customErrorText.style.display = "block";
customTip.classList.add("error");
} else {
customErrorText.style.display = "none";
customTip.classList.remove("error");
}
if (peopleAmount.value < 1) {
tipAmountValue.innerText = "$0.00";
totalAmountValue.innerText = "$0.00";
peopleErrorText.style.display = "block";
peopleAmountBox.classList.add("error");
} else {
peopleErrorText.style.display = "none";
peopleAmountBox.classList.remove("error");
}
Подробнее здесь: https://stackoverflow.com/questions/798 ... javascript
Мобильная версия