Input Month disabled
Attribute
Example
Disable the month field:
document.getElementById("myMonth").disabled = true;
The result could be:
Definition and Usage
The disabled
attribute is used to set or return whether the month field is disabled.
Elements with the disabled
attribute are unusable and unclickable. Disabled elements are typically displayed as grayed out in the browser.
This attribute reflects the HTML disabled
attribute.
Browser Support
All major browsers support the disabled
attribute.
Note: Internet Explorer or Firefox browsers do not support the <input>
element with the type="month"
attribute.
Syntax
Return the disabled
attribute:
Set the disabled
attribute:
Attribute Values
Value | Description | |
---|---|---|
true | false | Describes whether the month field is usable. true - The month field is unusable<br> false - Default. The month field is usable |
Technical Details
| Return Value: | Boolean, returns true if the month field is unusable, otherwise returns false | | --- | --- |
More Examples
Example
Check if the month field is usable:
var x = document.getElementById("myMonth").disabled;
true
Example
Disable or enable the month field:
function disableBtn() { document.getElementById("myMonth").disabled = true;
}
function undisableBtn() { document.getElementById("myMonth").disabled = false;
}
Related Pages
HTML Reference: HTML <input> disabled Attribute