The HTML DOM Input Date step property determines the legal day intervals to choose from when user opens the calendar. It sets or returns the input date step attribute value.
Syntax
Following is the syntax −
- Returning number value
inputDateObject.step
- Setting value attribute to a number value
inputDateObject.step = number
Example
Let us see an example of Input Date step property −
<!DOCTYPE html> <html> <head> <title>Input Date required</title> </head> <body> <form> <div> Odd Days Calendar: <input type="date" id="dateSelect" step="2"> </div> </form> <div id="divDisplay"></div> <script> var divDisplay = document.getElementById("divDisplay"); var inputDate = document.getElementById("dateSelect"); divDisplay.textContent = 'Current step: '+inputDate.step; </script> </body> </html>
Output
This will produce the following output. Here, step was set to 2 −