Javascript examples for DOM HTML Element:Input Time
The value property sets or gets the value attribute of a time field.
Set the value property with the following Values
Value | Description |
---|---|
hh:mm:ss.ms | Sets a time for the time field. |
Examples: "09:55:33.55", "22:15:35" or "16:00".
A String, representing the time (with no timezone information) of the time field
The following code shows how to Set a time for a time field:
<!DOCTYPE html> <html> <body> Time: <input type="time" id="myTime" value="16:32:55"> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/*from www . j av a 2s .c o m*/ document.getElementById("myTime").value = '22:22:22'; } </script> </body> </html>