
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
HTML DOM Input Number stepDown() Method
The HTML DOM input number stepDown() method decrements the value of input number field by a specified value.
Syntax
Following is the syntax −
object.stepDown(number)
Here, if number parameter is omitted then it decrements the value by 1.
Example
Let us see an example of input number stepDown() method −
<!DOCTYPE html> <html> <head> <title>HTML DOM stepUp()/stepDown() Demo</title> <style> body{ text-align:center; background: linear-gradient(62deg, #FBAB7E 0%, #F7CE68 100%) center/cover no-repeat; height:100vh; color:#fff; } p{ font-size:1.5rem; } input{ width:40%; } button{ background-color:#db133a; color:#fff; padding:8px; border:none; width:120px; margin:1rem; border-radius:50px; outline:none; cursor:pointer; } </style> </head> <body> <h1>stepUp()/stepDown() Method Demo</h1> <p>Hi! How old are you?</p> <input type="number"> <br> <button onclick="incValue()">StepUp Value</button> <button onclick="decValue()">StepDown Value</button> <script> function incValue() { document.querySelector("input").stepUp(10); } function decValue() { document.querySelector("input").stepDown(10); } </script> </body> </html>
Output
This will produce the following output −
Now Click on “StepUp Value” or “StepDown Value” button to increment or decrement the value of input number field.
- Related Articles
- HTML DOM Input Week stepDown( ) Method
- HTML DOM Input Range stepDown() method
- HTML DOM Input Month stepDown() Method
- HTML DOM Input Date stepDown() Method
- HTML DOM Input DatetimeLocal stepDown( ) Method
- HTML DOM Input Time stepDown( ) Method
- HTML DOM Input Number stepUp() Method
- HTML DOM Input Number Object
- HTML DOM Input Week stepUp( ) Method
- HTML DOM Input Range stepUp() method
- HTML DOM Input Month stepUp() Method
- HTML DOM Input Date stepUp() Method
- HTML DOM Input DatetimeLocal stepUp( ) Method
- HTML DOM Input Time stepUp( ) Method
- HTML DOM Input Number type Property

Advertisements