Input Number stepDown() Method - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Number

Description

The stepDown() method decrements the value of the number field by a specified number.

Parameter Values

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

Return Value:

No return value

The following code shows how to Decrement 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() {//ww w  . ja  v a2 s  .  c o  m
    document.getElementById("myNumber").stepDown(5);
}
</script>

</body>
</html>

Related Tutorials