Input Month disabled attribute

Definition and Usage

disabled Set or return whether the month field should be disabled.

Disabled elements are not available and cannot be clicked. By default, disabled elements are usually displayed in gray in the browser.

This property reflects the HTML disabled attribute.

See also:

HTML Reference Manual:HTML <input> disabled Attribute

Example

Example 1

Disable the month field:

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

Try it yourself

Example 2

Check if the month field is disabled:

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

Try it yourself

Example 3

Disable and enable the month field:

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

Try it yourself

Syntax

Return the disabled attribute:

monthObject.disabled

Set the disabled attribute:

monthObject.disabled = true|false

Attribute value

Value Description
true|false

Specify whether the month field should be disabled.

  • true - The month field is disabled
  • false - Default. The month field is not disabled

Technical Details

Return value: Boolean value, returns if the month field is disabled true; otherwise return false.

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support 10.0 Support Support Support

Note:The <input type="month"> element does not display any date field/calendar in Firefox.