Input Month disabledProperty

Input Month 对象参考手册Input Month Object

Example

Disable the month field:

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

The result could be:


Try it Yourself »

Definition and Usage

The disabled property is used to set or return whether the month field is disabled.

Elements using the disabled attribute are unavailable and unclickable. Disabled elements are usually displayed in gray in browsers.

This property reflects the HTML disabled attribute.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the disabled property

Note:Internet Explorer or Firefox do not support <input> elements with the type="month" attribute.


Syntax

Return the disabled property:

monthObject.disabled

Set the disabled property:

monthObject.disabled=true|false

Property Values

Value Description
true|false Describes whether the month field is enabled.
  • true - The month field is disabled
  • false - Default. The month field is enabled

Technical Details

Return value: A Boolean value, returns true if the month field is disabled, otherwise returns


More Examples

Example

Check whether the month field is enabled:

var x = document.getElementById("myMonth").disabled;
xThe output result is:
true

Try it Yourself »

Example

Disable or enable the month field:

function disableBtn() {
    document.getElementById("myMonth").disabled = true;
}
function undisableBtn() {
    document.getElementById("myMonth").disabled = false;
}

Try it Yourself »


Related Pages

HTML Reference Manual:HTML <input> disabled attribute


Input Month 对象参考手册Input Month Object Other Extensions