YouTip LogoYouTip

Prop Datetime Local Readonly

# Input DatetimeLocal readOnly Property [![Image 8: Input DatetimeLocal Object Reference Manual](#) Input DatetimeLocal Object](#) ## Example Set the local datetime field to read-only: document.getElementById("myLocalDate").readOnly = true; Output: [Try it Yourself Β»](#) * * * ## Definition and Usage The readOnly property is used to set or return whether a local datetime 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 the (#) property instead. * * * ## Browser Support ![Image 9: Internet Explorer](#)![Image 10: Firefox](#)![Image 11: Opera](#)![Image 12: Google Chrome](#)![Image 13: Safari](#) The readOnly property is supported by all major browsers. **Note:** The element is not supported in Internet Explorer or Firefox. * * * ## Syntax Return the readOnly property: _datetimelocalObject_.readOnly Set the readOnly property: _datetimelocalObject_.readOnly=true|false ## Property Values | Value | Description | | --- | --- | | true|false | Specifies whether the local datetime field is read-only * true - The local datetime field is read-only * false - Default. The local datetime field is not read-only | ## Technical Details | Return Value: | A Boolean. Returns true if the local datetime field is read-only, otherwise returns false. | | --- | * * * ## More Examples ## Example Check if the local datetime field is read-only: var x = document.getElementById("myLocalDate").readOnly; The _x_ output will be: true [Try it Yourself Β»](#) * * * ## Related Pages HTML Reference: (#) * * Input DatetimeLocal Object](#)
← Prop Datetime Local RequiredProp Datetime Local Name β†’