Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Input Month readOnly Property

Input Month readOnly Property

Input Month Object Reference Input Month Object

Example

Set the month field to read-only:

document.getElementById("myMonth").readOnly = true;

Output result:

Try it »


Definition and Usage

The readOnly property is used to set or return whether the month field is read-only.

A read-only field cannot be modified. However, its content can be copied.

This attribute reflects the HTML readonly attribute.

**Tip:** To ensure the accuracy of form data, you can use disabled the attribute instead.


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the readOnly attribute.

**Note:** Internet Explorer or Firefox browsers do not support the HTML using the type="month" attribute .


Syntax

Return the readOnly attribute:

monthObject

.readOnly

Set the readOnly attribute:

monthObject

.readOnly=true|false

Attribute values

Value Description
true|false Describes whether the month field is read-only
  • true - the month field is read-only
  • false - default. The month field is not read-only
  • |

    Technical Details

    Return Value: Boolean, returns true if the month field is read-only, otherwise returns false.

    More examples

    Example

    Check whether the month field is read-only:

    var x = document.getElementById("myMonth").readOnly;

    x

    The output is:

    true

    Try it »


    Related pages

    HTML Reference Manual: HTML readonly attribute


    Input Month Object Reference Input Month Object