Input Time value Property
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
Property | |||||
---|---|---|---|---|---|
value | Yes | 10.0 | Yes | Yes | Yes |
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;
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