l1ghtik,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
</style>
</head>
<body>
<form>
<input type="number" name="number" value="1.5" step=".1" min="0">
<input type="submit" value="снять указанную сумму">
</form>
<p class="out">5₽</p>
<script>
var a = 5;
document.querySelector("form").addEventListener("submit", function(event) {
event.preventDefault();
var str = "На балансе недостаточно средств";
var b = this.number.valueAsNumber
if (a >= b) {
a -= b;
str = a.toLocaleString("ru", { style: "currency", currency: "RUB" });
}
document.querySelector(".out").innerHTML = str;
})
</script>
</body>
</html>