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

HTML DOM Input Search disabled Property

Input Search disabled Property

Input Search Object Reference Input Search Object

Example

Disable the search field:

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

Output result:

Try it »


Definition and Usage

The disabled property sets or returns whether the search 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


Syntax

Return the disabled attribute:

searchObject

.disabled

Set the disabled attribute:

searchObject

.disabled=true|false

Attribute values

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

    Technical Details

    Return Value: A Boolean value that returns true if the search field is disabled, otherwise returns false

    More examples

    Example

    Check whether the search field is available:

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

    x

    The output is:

    true

    Try it »

    Example

    Disable or enable the search field:

    function disableBtn() {

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

    }

    function undisableBtn() {

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

    }

    Try it »


    Related pages

    HTML Reference Manual: HTML disabled attribute


    Input Search Object Reference Input Search Object