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

HTML DOM Input Date disabled attribute

Input Date disabled attribute

Input Date Object Reference Input Date Object

Example

Disable the date field:

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

The result could be:

Try it »


Definition and Usage

The disabled attribute sets or returns whether the date field is available.

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 attribute.

Note: Internet Explorer or Firefox browsers do not support .


Syntax

Return the disabled attribute:

inputdateObject

.disabled

Set the disabled attribute:

inputdateObject

.disabled=true|false

Attribute values

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

    Technical Details

    Return Value: Boolean value, returns true if the date field is available, otherwise returns false.

    More examples

    Example

    Check whether the date field is available:

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

    x

    The output is:

    true

    Try it »

    Example

    Disable and enable the date field:

    function disableBtn() {

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

    }

    function undisableBtn() {

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

    }

    Try it »


    Related pages

    HTML Reference Manual: HTML disabled attribute


    Input Date Object Reference Input Date Object