
- 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 Date stepDown() Method
The HTML DOM Input Date stepdown() method defines the amount of days the date field should decrease.
Syntax
Following is the syntax −
Calling stepDown method with a number, which by default is equal to 1
inputDateObject.stepDown(number)
Example
Let us see an example of Input Date stepDown method −
<!DOCTYPE html> <html> <head> <title>Input Date stepDown()</title> </head> <body> <form> <div> Calendar: <input type="date" id="dateSelect" value ="2019-07-07"> </div> </form> <button onclick="changeStep(2)">Decrease by 2</button> <button onclick="changeStep(3)">Decrease by 3</button> <div id="divDisplay"></div> <script> var divDisplay = document.getElementById("divDisplay"); var inputDate = document.getElementById("dateSelect"); function changeStep(num){ if(num===2) inputDate.stepDown(2); else inputDate.stepDown(3); divDisplay.textContent = 'Current date decreased by: '+num; } </script> </body> </html>
Output
This will produce the following output −
Clicking ‘Decrease by 2’ button −
Clicking ‘Decrease by 3’ button −
- Related Articles
- HTML DOM Input Month stepDown() Method
- HTML DOM Input Number stepDown() Method
- HTML DOM Input Range stepDown() method
- HTML DOM Input DatetimeLocal stepDown( ) Method
- HTML DOM Input Time stepDown( ) Method
- HTML DOM Input Week stepDown( ) Method
- HTML DOM Input Date stepUp() Method
- HTML DOM Input Date Object
- HTML DOM Input Date autofocus Property
- HTML DOM Input Date disabled Property
- HTML DOM Input Date form Property
- HTML DOM Input Date name Property
- HTML DOM Input Date max Property
- HTML DOM Input Date min Property
- HTML DOM Input Date readOnly Property

Advertisements