Input Date disabled attribute
Example
Disable the date field:
document.getElementById("myDate").disabled = true;
The result could be:
Try it »
Definition and Usage
The disabled attribute sets or returns whether the date field is available.
Elements with the disabled attribute are unavailable and not clickable. Disabled elements are usually displayed in gray 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 .
Syntax
Return the disabled attribute:
inputdateObject
.disabled
Set the disabled attribute:
inputdateObject
.disabled=true|false
Attribute values
| Value | Description |
|---|---|
| true|false | Describes whether the date field is available.
|
Technical Details
| Return Value: | Boolean value, returns true if the date field is available, otherwise returns false. |
|---|
More examples
Example
Check whether the date field is available:
var x = document.getElementById("myDate").disabled;
x
The output is:
true
Try it »
Example
Disable and enable the date field:
function disableBtn() {
document.getElementById("myDate").disabled = true;
}
function undisableBtn() {
document.getElementById("myDate").disabled = false;
}
Try it »
Related pages
HTML Reference Manual: HTML disabled attribute
Input Date Object