Javascript DOM HTML Input Number stepUp() Method without parameter

Introduction

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

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

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

This is the same as clicking the up 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() {/*from  w w w  .  j  a v a 2 s  . co  m*/
  document.getElementById("myNumber").stepUp();
}
</script>

</body>
</html>



PreviousNext

Related