YouTip LogoYouTip

Prop Month Readonly

HTML DOM Input Month readOnly Property

HTML DOM Input Month readOnly Property

-- Learning is not just about technology, but also about dreams!

JavaScript Reference

Overview

JavaScript Objects

Browser Objects

DOM Objects

HTML Objects

<input> - image

<input> - number

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:

Try it Yourself Β»


Definition and Usage

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

A read-only field cannot be modified. However, a user can tab to it, highlight it, and copy content from it.

The property reflects the HTML readonly attribute.

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


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

The readOnly property is supported in all major browsers.

Note: The <input> element with type="month" is not supported in Internet Explorer or Firefox.


Syntax

Get the readOnly property:

monthObject.readOnly

Set the readOnly property:

monthObject.readOnly=true|false

Property Values

Value Description
true|false Specifies 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: A Boolean. Returns true if the month field is read-only, otherwise it returns false.

More Examples

Example

Check if the month field is read-only:

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

The value of x will be:

true

Try it Yourself Β»


Related Pages

HTML Reference: HTML <input> readonly Attribute


Input Month Object Reference Input Month Object

← Prop Month RequiredProp Month Name β†’