Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Input Time disabled property

Input Time disabled property

Input Time Object Reference Input Time Object

Example

Disable the time field:

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

The result could be:

Try it »


Definition and Usage

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

Elements with the disabled attribute are unavailable and not clickable. Disabled elements are usually displayed in gray in the browser.

This attribute reflects the HTML disabled attribute.


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the disabled property

Note: Internet Explorer or Firefox browsers do not support HTML using the type="time" attribute .


Syntax

Return the disabled attribute:

timeObject

.disabled

Set the disabled attribute:

timeObject

.disabled=true|false

Attribute values

Value Description
true|false Describes whether the time field is available.
  • true - the time field is unavailable
  • false - default. The time field is available
  • |

    Technical Details

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

    More examples

    Example

    Check whether the time field is available:

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

    x

    The output is:

    true

    Try it »

    Example

    Disable and enable the time field:

    function disableBtn() {

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

    }

    function undisableBtn() {

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

    }

    Try it »


    Related pages

    HTML Reference Manual: HTML disabled attribute


    Input Time Object Reference Input Time Object