Javascript examples for DOM HTML Element:Input Datetime Local
The step property sets or gets the step attribute of a local datetime field, which controls the legal number intervals for seconds or milliseconds in a local datetime field.
Example: if step="2", legal numbers could be 0, 2, 4, etc.
You can use step attribute to create a range of legal values.
Set the step property with the following Values
Value | Description |
---|---|
number | Sets the legal number intervals in the local datetime field. |
A Number, representing the legal number intervals for seconds or milliseconds
The following code shows how to change the legal number intervals for seconds in a local date field:
<!DOCTYPE html> <html> <body> Date: <input type="datetime-local" id="myLocalDate" value="2018-11-16T15:00:33"> <button onclick="myFunction()">Test</button> <script> function myFunction() {//from ww w.j a v a 2 s .co m document.getElementById("myLocalDate").stepUp(); } </script> </body> </html>