Example
Set a time for a time field:
document.getElementById("myTime").value = "22:53:05";
Try it Yourself »
Definition and Usage
The value property sets or returns the value of the value attribute of a time field.
The value attribute specifies a time for the time field.
Browser Support
The value property is supported in all major browsers.
Note: The <input type="time"> element is not supported in Internet Explorer or Firefox.
Syntax
Return the value property:
timeObject.value
Set the value property:
timeObject.value=hh:mm:ss.ms
Property Values
Value | Description |
---|---|
hh:mm:ss.ms |
Specifies a time for the time field. Explanation of components:
|
Technical Details
Return Value: | A String, representing the time (with no timezone information) of the time field |
---|
More Examples
Example
Get the time of a time field:
var x =
document.getElementById("myTime").value;
The result of x will be:
16:32:55
Try it Yourself »
Example
An example that shows the difference between the defaultValue and value property:
var x = document.getElementById("myTime");
var defaultVal =
x.defaultValue;
var currentVal = x.value;
Try it Yourself »
Related Pages
HTML reference: HTML <input> value attribute
< Input Time Object