Input Time disabledProperty

Input Time 对象参考手册Input Time Object

Examples

Disable the time field:

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

The result could be:


Try it Yourself »

Definition and Usage

The disabled property sets or returns whether a time field is disabled.

Elements with the disabled attribute are unusable and unclickable. Disabled elements are usually displayed in gray in browsers.

This property reflects the HTML disabled attribute.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the disabled property

Note:Internet Explorer or Firefox does not support HTML <input> elements with type="time".


Syntax

Return the disabled property:

timeObject.disabled

Set the disabled property:

timeObject.disabled=true|false

Property Values

Value Description
true|false Describes whether the time field is enabled.
  • true - The time field is disabled
  • false - Default. The time field is enabled

Technical Details

Return Value: Boolean value, returns true if the time field is disabled, otherwise false


More Examples

Example

Find out if a time field is enabled:

var x = document.getElementById("myTime").disabled;
xThe result is:
true

Try it Yourself »

Example

Disable and enable a time field:

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

Try it Yourself »


Related Pages

HTML Reference:HTML <input> disabled attribute


Input Time 对象参考手册Input Time Object Other Extensions