Easy Tutorial
❮ Jsref Charcodeat Event Onoffline ❯

Input Search disabled Attribute

Input Search Object

Example

Disable the search field:

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

Output result:


Definition and Usage

The disabled attribute is used to set or return whether the search field is disabled.

Elements with the disabled attribute are unusable and unclickable. Disabled elements are typically displayed in a grayed-out state in the browser.

This attribute reflects the HTML disabled attribute.


Browser Support

All major browsers support the disabled attribute.


Syntax

Return the disabled attribute:

Set the disabled attribute:

Attribute Values

Value Description
true false Describes whether the search field is usable. true - The search field is unusable <br> false - Default. The search field is usable

Technical Details

| Return Value: | Boolean, returns true if the search field is unusable, otherwise returns false | | --- | --- |


More Examples

Example

Check if the search field is usable:

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

Example

Disable or enable the search field:

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

Related Pages

HTML Reference: HTML <input> disabled Attribute


❮ Jsref Charcodeat Event Onoffline ❯