Input Month readOnly attribute
Definition and Usage
readOnly
Set or return whether the month field should be read-only.
You cannot modify the read-only field. However, users can select, highlight it, and copy text from it.
This property reflects the HTML readonly attribute.
Tip:To prevent users from interacting with the field, use disabled attribute.
See also:
HTML Reference Manual:خصائص readonly في <input> HTML
Example
Example 1
Set the month field to read-only:
document.getElementById("myMonth").readOnly = true;
Example 2
Check if the month field is read-only:
var x = document.getElementById("myMonth").readOnly;
Syntax
Return the readOnly property:
monthObject.readOnly
Set the readOnly property:
monthObject.readOnly = true|false
Attribute value
Value | Description |
---|---|
true|false |
Specify whether the month field should be read-only
|
تفاصيل التقنية
القيمة التي تعود: | قيمة بولية، إذا كان حقل الشهر قابلاً للقراءة فقط، فإنه يعود true ؛ وإلا فإنه يعود false . |
---|
دعم المتصفحات
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
دعم | 10.0 | دعم | دعم | دعم |
ملاحظة:عند استخدام <input type="month"> في Firefox لا يتم عرض أي حقل تاريخ أو تقويم.