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 accessible 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> Ατσάλινη Προσθήκη

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 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;εάν όχι, επιστρέφει false.

Υποστήριξη Βrowser

Τα αριθμήματα στη τάβλη αποκαλύπτουν την έκδοση του πρώτου προγράμματος που υποστηρίζει πλήρως την ιδιότητα.

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Υποστήριξη 10.0 Υποστήριξη Υποστήριξη Υποστήριξη

Σημείωση:Η παράμετρος <input type="datetime-local"> δεν εμφανίζει κανένα πεδίο ημερομηνίας/χρονομετρητή στον Firefox.