Latest web development tutorials

HTML DOM Input Time readOnly property

Input Time Object Reference Input Time Object

Examples

Setting time field is read-only:

. Document.getElementById ( "myTime") readOnly = true;

Output:


try it"

Definition and Usage

readOnly property sets or returns the time whether the field is read-only.

Read-only fields can not be modified. But you can copy the contents of the field.

This property reflects the HTML readonly attribute.

Tip: To ensure the accuracy of the form data, you can use the disabled property instead.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support readOnly property

Note: Internet Explorer or Firefox browser does not support type = "time" attribute of the HTML <input> elements.


grammar

Back readOnly attributes:

timeObject .readOnly

Set readOnly properties:

timeObject .readOnly = true | false

Property Value

value description
true | false It describes the time the field is read-only
  • true - time field is read-only
  • false - default. time field is not read-only

technical details

return value: Boolean value that, if the time is read-only field returns true, otherwise returns false.


More examples

Examples

Check time field is read-only:

var x = document.getElementById ( "myTime") readOnly.;
x The output is:
true

try it"


Related Pages

HTML Reference Manual: HTML <the INPUT> Readonly property


Input Time Object Reference Input Time Object