HTML DOM Input Month readOnly property
Examples
Month field is set to read-only:
document.getElementById("myMonth").readOnly = true;
Output:
try it"
Definition and Usage
readOnly property sets or returns the month 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
All major browsers support readOnly property.
Note: Internet Explorer or Firefox browser does not support type = "month" <input> element attributes.
grammar
Back readOnly attributes:
monthObject .readOnly
Set readOnly properties:
monthObject .readOnly=true|false
Property Value
值 | 描述 |
---|---|
true|false |
描述了 month 字段是否只读
|
technical details
return value: | Boolean value that, if the field is read-month returns true, otherwise returns false. |
---|
More examples
Examples
View month field is read-only:
var x = document.getElementById("myMonth").readOnly;
x The output is: true
try it"
Related Pages
HTML Reference Manual: HTML <the INPUT> Readonly property
