Input DatetimeLocal disabled attribute
Example
Disable the local datetime field:
document.getElementById("myLocalDate").disabled = true;
The output result is:
Try it »
Definition and Usage
The disabled attribute is used to set or return whether the local datetime field is disabled.
Elements with the disabled attribute are unavailable and not clickable. Disabled elements are usually displayed in gray in the browser.
The attribute reflects the HTML disabled attribute.
Browser support





All major browsers support the disabled attribute.
**Note:** Internet Explorer or Firefox browser does not support .
Syntax
Return the disabled attribute:
datetimelocalObject
.disabled
Set the disabled attribute:
datetimelocalObject
.disabled=true|false
Attribute values
| Value | Description |
|---|---|
| true|false | Describes whether the local datetime field is available.
|
Technical Details
| Return Value: | Boolean value, returns true if the local datetime field is unavailable, otherwise returns false |
|---|
More examples
Example
Check whether the local datetime field is available:
var x = document.getElementById("myLocalDate").disabled;
x
The output is:
true
Try it »
Example
Disable or enable the local datetime field:
function disableBtn() {
document.getElementById("myLocalDate").disabled = true;
}
function undisableBtn() {
document.getElementById("myLocalDate").disabled = false;
}
Try it »
Related pages
HTML Reference Manual: HTML disabled attribute
Input DatetimeLocal Object