Input Number stepUp() Method - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Number

Description

The stepUp() method increments the value of the number field by a specified number.

Parameter Values

Parameter Description
numberRequired. Specifies the amount the value of the number field should increase. Default is "1"

Return Value:

No return value

The following code shows how to Increment the value of a number field by 5:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>
Number: <input type="number" id="myNumber">

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

<script>
function myFunction() {/*from  w  ww . ja  va  2 s  .c  om*/
    document.getElementById("myNumber").stepUp(5);
}
</script>

</body>
</html>

Related Tutorials