Javascript DOM HTML Input Number stepDown() Method without parameter

Introduction

Decrement the value of a number field by 1 (default):

document.getElementById("myNumber").stepDown();

Click the button to decrement the value of the number field by 1.

This is the same as clicking the down arrow on the right side of the number field.

View in separate window

<!DOCTYPE html>
<html>
<body>

Number: <input type="number" id="myNumber">

<button onclick="myFunction()">Test</button>

<script>
function myFunction() {//  w w  w.  j  a  va 2s.c o  m
  document.getElementById("myNumber").stepDown();
}
</script>

</body>
</html>



PreviousNext

Related