Input Time disabled Attribute

Definition and Usage

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

Example

Example 1

Disable the time field:

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

Try it yourself

Example 2

Check if the time field is disabled:

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

Try it yourself

Example 3

Enable and disable the time field:

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

Try it yourself

Syntax

Return the disabled attribute:

timeObject.disabled

Set the disabled attribute:

timeObject.disabled = true|false

Attribute value

Value Description
true|false

Specify whether the time field should be disabled.

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

Technical Details

Return value: Boolean value, if the time field is disabled, it returns 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="time"> element does not display as any time field in Firefox.