Increment and Decrement Number
Increment or Decrement Number By clicking on Icons. for that get the input number by using getElementById and assign it to a variable.
for icons, we have to import icons to your file.
<html>
<head>
<title>Increment or Decrement Value
</head>
<body>
<div id="increase" onclick="increase value()" value="Increase Value">
<i class="fa-solid fa-angle-up"></i>
</div>
<div><input type="number" id="number" value="0" /></div>
<div id="decrease" onclick="decrease-value()" value="Decrease Value">
<i class="fa-solid fa-angle-down"></i>
</div>
</body>
<script>
function increase value() {
var value = parseInt(document.getElementById('number').value, 10);
value = isNaN(value) ? 0 : value;
value++;
document.getElementById('number').value = value;
}
function decrease-value() {
var value = parseInt(document.getElementById('number').value, 10);
value = isNaN(value) ? 0 : value;
value < 1 ? value = 1 : '';
value--;
document.getElementById('number').value = value;
}
</script>
<script>
</html>