Input Search disabledProperty

Input Search 对象参考手册Input Search Object

Examples

Disable the search field:

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

Output result:


Try it Yourself »

Definition and Usage

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

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

This property reflects the HTML disabled attribute.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the disabled property


Syntax

Return the disabled property:

searchObject.disabled

Set the disabled property:

searchObject.disabled=true|false

Property Values

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

Technical Details

Return Value: A Boolean value, 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;
xThe output result is:
true

Try it Yourself »

Example

Disable or enable the search field:

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

Try it Yourself »


Related Pages

HTML Reference Manual:HTML <input> disabled attribute


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