Input DatetimeLocal disabled attribute

Definition and Usage

disabled Property to set or return whether the local date and time 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 local date and time field:

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

Try It Yourself

Example 2

Check if the local date and time field is disabled:

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

Try It Yourself

Example 3

Disable and enable the local date and time field:

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

Try It Yourself

Syntax

Return the disabled property:

datetimelocalObject.disabled

Set the disabled property:

datetimelocalObject.disabled = true|false

Property Value

Value Description
true|false

Specifies whether the local date and time field should be disabled.

  • true - The local date and time field is disabled
  • false - Default. The local date and time field is not disabled

Technical Details

Return value: Boolean value, returned if the local date and time field is disabled true; otherwise return false.

Browser Support

The numbers in the table indicate the first browser version that fully supports this attribute.

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

Note:The <input type="datetime-local"> element does not display any date and time field/calendar in Firefox.