Latest web development tutorials

HTML DOM Input Date readOnly property

Input Date Object Reference Input Date Object

Examples

Set the date field is read-only:

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

Output:


try it"

Definition and Usage

readOnly property is used to set the return date field is read-only or returns.

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 <input type = "date"> element.


grammar

Back readOnly attributes:

inputdateObject .readOnly

Set readOnly properties:

inputdateObject .readOnly = true | false

Property Value

value description
true | false Describes the date fields are read-only:
  • true - date fields are read-only
  • false - default. date field is not read-only.

technical details

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


More examples

Examples

Check date fields are read-only:

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

try it"


related articles

HTML Reference Manual: HTML <the INPUT> Readonly property


Input Date Object Reference Input Date Object