Input Month step Property
Example
Change the legal month intervals:
document.getElementById("myMonth").step = "2";
Try it Yourself »
Description
The step property sets or returns the value of the step attribute of a month field.
The step attribute specifies the legal month intervals to choose from when the user opens the calendar in the month field.
For example, if step = "2", you can only select every second month in the calendar (like January, March, May).
Browser Support
Property | |||||
---|---|---|---|---|---|
step | Yes | Not supported | Not supported | Yes | Yes |
Note: The <input type="month"> element does not show any date field/calendar in Firefox.
Syntax
Return the step property:
monthObject.step
Set the step property:
monthObject.step = number
Property Values
Value | Description |
---|---|
number |
Specifies the legal month intervals. Default is 1 month. Examples: If step="2", you can only select every second month in the month calendar. If step="5", you can only select every fifth month in the month calendar. |
Technical Details
Return Value: | A Number, representing the legal month intervals |
---|
More Examples
Example
Get the legal month intervals:
var x = document.getElementById("myMonth").step;
Try it Yourself »
Related Pages
HTML reference: HTML <input> step attribute
❮ Input Month Object
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.