Change the legal number intervals for seconds in a local date field:
The step property sets or returns the value of the step attribute of a local datetime field.
The step attribute specifies the legal number intervals for seconds or milliseconds in a local datetime field (does not apply for days, months, years, hours or minutes).
Example: if step="2", legal numbers could be 0, 2, 4, etc.
Tip: The step attribute is often used together with the max and min attributes to create a range of legal values.
The step property is supported in all major browsers.
Note: The step property is not supported in Internet Explorer 9 and earlier versions.
Note: The <input type="datetime-local"> element is not supported in Internet Explorer or Firefox.
Return the step property:
Set the step property:
Value | Description |
---|---|
number |
Specifies the legal number intervals in the
local datetime field.
For seconds:
For milliseconds:
|
Return Value: | A Number, representing the legal number intervals for seconds or milliseconds |
---|
Change the legal number intervals for milliseconds in a local date field:
Get the legal number intervals for seconds in a local date field:
The result of x will be:
HTML reference: HTML <input> step Attribute