HTML | DOM Input DatetimeLocal step Property
The Input DatetimeLocal Step property in HTML DOM is used to set or return the value of the step attribute of a local datetime field. The Input Step attribute can be used for specifying the legal number intervals for seconds or milliseconds in a local datetime field. The step property cannot be used to affect the days, months, years, hours or minutes.
Syntax:
- It returns the Input DatetimeLocal Step property.
datetimelocalObject.step
- It is used to set Input DatetimeLocal Step property.
datetimelocalObject.step = number
Property Values: It contains single property value number which is used to specify the legal number intervals for seconds or milliseconds.
Return Value: It returns a numeric value, which represents the legal number intervals for seconds or milliseconds
Below program illustrates the DatetimeLocal step property in HTML DOM:
Example: This example changes the legal number intervals for seconds in a local date field.
html
<!DOCTYPE html> < html > < head > < title > HTML DOM Input DatetimeLocal step Property </ title > </ head > < body style = "text-align:center;" > < h1 style = "color:green;" > w3wiki </ h1 > < h2 style = "font-family: Impact;" > Input DatetimeLocal step Property </ h2 > < input type = "datetime-local" id = "Test_Datetime" > < p > To update the step, double click the "Change Step" button. </ p > < button ondblclick = "My_DatetimeLocal()" > Change Step </ button > < p id = "test" ></ p > < script > function My_DatetimeLocal() { document.getElementById("Test_Datetime").step = "5"; document.getElementById("test").innerHTML = "The step attribute has been " + "changed to '5'."; } </ script > </ body > </ html > |
Output: Before clicking the button: After clicking the button: Note: The <input type=”datetime-local”> element does not show any datetime field/calendar in Firefox.
Supported Browsers: The browser supported by Input DatetimeLocal step property are listed below:
- Google Chrome 20
- Edge 12
- Firefox 93
- Opera 11
- Safari 14.1