Input Month step Attribute
Definition and Usage
step
Sets or returns the value of the step attribute of the month field.
The HTML step attribute specifies the legal month intervals that can be selected when the user opens the calendar in the month field.
For example, if step = "2", then only every other month can be selected from the calendar (such as January, March, May).
See also:
HTML Reference Manual:HTML <input> step Attribute
Example
Example 1
Change the legal month interval:
document.getElementById("myMonth").step = "2";
Example 2
Get the legal month interval:
var x = document.getElementById("myMonth").step;
Syntax
Return the step attribute:
monthObject.step
Set the step attribute:
monthObject.step = number
Attribute value
Value | Description |
---|---|
number |
Define the legal month interval. The default is 1 month. Example:
|
Technical Details
Return Value: | A number representing the legal month interval. |
---|
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Supported | Not Supported | Not Supported | Supported | Supported |
Note:The <input type="month"> element does not display any date field/calendar in Firefox.