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