Increment the value of a number field by 5:
document.getElementById("myNumber").stepUp(5);
Click the button to increment the value of the number field by 5.
<!DOCTYPE html> <html> <body> Number: <input type="number" id="myNumber"> <button onclick="myFunction()">Test</button> <script> function myFunction() {/*from w ww . ja va 2s . co m*/ document.getElementById("myNumber").stepUp(5); } </script> </body> </html>
The stepUp()
method increments the value of the number field by a specified number.
Parameter | Description |
---|---|
number | Required. Specifies the amount the value of the number field should increase. |
If omitted, the numbers are incremented by "1"