Input DatetimeLocal disabled attribute

Definition and usage

disabled Attribute sets or returns 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 Atryubuto

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

Enable and disable 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 disabled attribute:

datetimelocalObject.disabled

Set disabled attribute:

datetimelocalObject.disabled = true|false

Attribute value

Value Description
true|false

Specify 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, if the local date and time field is disabled, it returns true; kung hindi, ibabalik false.

Browser Support

Ang numero sa talahanan ay naglalarawan ng unang bersyon ng browser na ganap na sumusuporta sa atryubuto na ito.

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Suporta 10.0 Suporta Suporta Suporta

Pagsisiwalat:Ang <input type="datetime-local"> element ay hindi nagpapakita ng anumang field ng petsa at oras/kalendaryo sa Firefox.