Input Time value attribute
Definition and Usage
value
Attribute sets or returns the value of the value attribute of the time field.
HTML value attribute specifies the time of the time field.
See also:
HTML Reference Manual:HTML <input> value Attribute
Instance
Example 1
Set the time of the time field:
document.getElementById("myTime").value = "18:45:30";
Example 2
Get the time of the time field:
var x = document.getElementById("myTime").value;
Example 3
An example showing the difference between the defaultValue and value attributes:
var x = document.getElementById("myTime"); var defaultVal = x.defaultValue; var currentVal = x.value;
Syntax
Return value attribute:
timeObject.value
Set value attribute:
timeObject.value = hh:mm:ss.ms
Attribute Value
Value | Description |
---|---|
hh:mm:ss.ms |
Time field of the specified time. Component Description:
Example: "08:39:21.33", "22:36:07" or "15:00". |
Technical Details
Return Value: | A string value representing the time of the time field (without timezone information). |
---|
Browser Support
The numbers in the table indicate the first browser version to fully support this property.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | 10.0 | Support | Support | Support |
Note:The <input type="time"> element does not display as any time field in Firefox.