Input Month readOnlyProperty
Examples
Set the month field to read-only:
document.getElementById("myMonth").readOnly = true;
Output:
Try it yourself »
Definition and Usage
The readOnly property is used to set or return whether the month field is read-only.
Read-only fields cannot be modified. However, the contents 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 <input> elements with the type="month" attribute.
Syntax
Return the readOnly property:
monthObject.readOnly
Set the readOnly property:
monthObject.readOnly=true|false
Property Values
| Value | Description |
|---|---|
| true|false | Describes whether the month field is read-only
|
Technical Details
| Return Value: | A Boolean value, returning true if the month field is read-only, otherwise returning false. |
|---|
More Examples
Example
Check whether the month field is read-only:
var x = document.getElementById("myMonth").readOnly;
xOutput:true
Try it yourself »
Related Pages
HTML Reference:HTML <input> readonly Attribute
Input Month Object Other Extensions