Input Time readOnlyProperty
Example
Set the time field to read-only:
document.getElementById("myTime").readOnly = true;
Output:
Try it Yourself »
Definition and Usage
The readOnly property is used to set or return whether the time field is read-only.
A read-only field cannot be modified. However, the content of the field can be copied.
This property reflects the HTML readonly attribute.
Tip:To ensure the accuracy of form data, you can use thedisabledattribute instead.
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the readOnly property
Note:Internet Explorer or Firefox browsers do not support HTML <input> elements with type="time" attribute.
Syntax
Return the readOnly property:
timeObject.readOnly
Set the readOnly property:
timeObject.readOnly=true|false
Property Values
| Value | Description |
|---|---|
| true|false | Describes whether the time field is read-only
|
Technical Details
| Return Value: | A Boolean, returning true if the time field is read-only, otherwise false. |
|---|
More Examples
Example
Check whether the time field is read-only:
var x = document.getElementById("myTime").readOnly;
xOutput:true
Try it Yourself »
Related Pages
HTML Reference:HTML <input> readonly Attribute
Input Time Object Other Extensions