Open In App

HTML | DOM Input Search disabled Property

Last Updated : 25 Aug, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

The DOM Input Search disabled Property in HTML DOM is used to return a boolean value that represents that a search field should be disabled or not. Disabled elements are shown in gray by default and are unusable and un-clickable. 

Syntax: 

  • It returns the disabled property.
searchObject.disabled
  • It is used to set the disabled property.
searchObject.disabled = true/false

Property Values: 

  • true: It specifies the search field is disabled.
  • false:It has a default value. It specifies the search field is not disabled.

Return Value: It returns a boolean value i.e. true if the search field is disabled or false if the search field is not disabled. 

Example-1: This example returns the value of disabled property. 

HTML




<!DOCTYPE html>
<html>
<head>
    <title>
      Input Search disabled Property
      </title>
    <style>
        h1 {
            color: green;
        }
        h2 {
            font-family: Impact;
        }
        body {
            text-align: center;
        }
    </style>
</head>
<body>
    <h1>GeeksforGeeks</h1>
    <h2>Input Search Disabled Property</h2>
    <form id="myGeeks">
        <input type="Search"
               id="test"
               name="myGeeks"
               placeholder="Type to search.."
               disabled>
    </form>
    <br>
    <br>
    <button ondblclick="Access()">
      click here
    </button>
 
    <p id="check"
       style="font-size:24px;
              color:green;">
      </p>
    <script>
        function Access() {
 
            // type="search"
            var s = document.getElementById(
                "test").disabled;
             
            document.getElementById(
                "check").innerHTML = s;
        }
    </script>
</body>
</html>


Output: 

Before Clicking On Button:

  

After Clicking On Button:

  

Example-2: This Example illustrates that how to set the Property. 

HTML




<!DOCTYPE html>
<html>
<head>
    <title>Input Search disabled Property</title>
    <style>
        h1 {
            color: green;
        }
        h2 {
            font-family: Impact;
        }
        body {
            text-align: center;
        }
    </style>
</head>
<body>
    <h1>GeeksforGeeks</h1>
    <h2>Input Search Disabled Property</h2>
    <form id="myGeeks">
        <input type="Search"
               id="test"
               name="myGeeks"
               placeholder="Type to search.."
               disabled>
    </form>
    <br>
    <br>
    <button ondblclick="Access()">
      click here
    </button>
    <p id="check"
       style="font-size:24px;
              color:green;">
      </p>
    <script>
        function Access() {
 
            // type="search"
            var s = document.getElementById(
                "test").disabled = false;
           
            document.getElementById(
                "check").innerHTML = s;
        }
    </script>
</body>
</html>


Output: 

Before Clicking On Button:

  

After Clicking On Button:

  

Supported Browsers: The browser supported by DOM input search disabled Property are listed below:

  • Google Chrome 5 and above
  • Edge 12 and above
  • Firefox 4 and above
  • Opera 10.6 and above
  • Safari 5 and above


Similar Reads

HTML | DOM Input Checkbox disabled Property
The Input Checkbox disabled property in HTML DOM is used to set or return whether the Input Checkbox field must be disabled or not. A disabled checkbox is unclickable and unusable. It is a boolean attribute and used to reflect the HTML Disabled attribute. Syntax: It returns the Input Checkbox disabled property. checkboxObject.disabled It is used to
2 min read
HTML | DOM Input Datetime disabled Property
The Input Datetime disabled property is used to set or return whether a datetime field should be disabled, or not. An element becomes unusable and un-clickable if it is disabled. Such elements are generally rendered in gray by browsers. The HTML disable attribute is reflected by the Datetime disabled property. Syntax: Returning the disabled propert
2 min read
HTML | DOM Input Date disabled Property
The Input date disabled property is used to set or return whether a date field should be disabled, or not. An element becomes unusable and un-clickable if it is disabled. Such elements are generally rendered in gray by browsers. The HTML disable attribute is reflected by the Date disabled property.Syntax: To return the disabled property: inputdateO
2 min read
HTML DOM Input DatetimeLocal disabled Property
The Input datetimeLocal disabled property in HTML DOM is used to set or return the local DateTime field which is disabled, or not. If an element is disabled then it becomes unusable and un-clickable. Such elements are generally rendered in gray by browsers. The HTML disable attribute is reflected by the DatetimeLocal disabled property.Syntax: It re
2 min read
HTML | DOM Input Email disabled Property
The Input Email disabled property in HTML DOM is used to set or return whether the Input Email field must be disabled or not. A disabled Input Email field is unclickable and unusable. It is a boolean attribute and used to reflect the HTML Disabled attribute. Syntax: It is used to return the disabled property. emailObject.disabledIt is used to set t
2 min read
HTML | DOM Input Password disabled Property
The DOM Input Password disabled Property is used to set or return the whether the Input Password Field must be disabled or not. A disabled Password Field is un-clickable and unusable. It is a boolean attribute and used to reflect the HTML Disabled attribute. It is usually rendered in grey color by default in all the Browsers. Syntax: It is used to
2 min read
HTML | DOM Input Text disabled Property
The DOM Input Text disabled Property is used to set or return the whether the Input Text Field must be disabled or not. A disabled Text Field is un-clickable and unusable. It is a boolean attribute and used to reflect the HTML Disabled attribute. It is usually rendered in grey color by default in all the Browsers.Syntax: It returns the disabled pro
2 min read
HTML | DOM Input Submit disabled Property
The Input Submit disabled property in HTML DOM is used to set or return the boolean value that represents a Submit field should be disabled or not. By default, the disabled elements are displayed in gray and are unusable and unclickable. Syntax: It returns the disabled property.submitObject.disabledIt is used to set the disabled property.submitObje
2 min read
HTML | DOM Input Reset disabled Property
The Input Reset disabled Property in HTML DOM is used to set or return a boolean value which represents a reset button field should be disabled or not. By default, the disabled elements are shown in gray and are unusable and unclickable. Syntax: It returns the disabled property.resetObject.disabledIt is used to set the disabled property.resetObject
2 min read
HTML | DOM Input Range disabled Property
The DOM Input Range disabled Property is used to set or return whether the Input range Field must be disabled or not. A disabled range Field is un-clickable and unusable. It is a boolean attribute and used to reflect the HTML Disabled attribute. It is usually rendered in grey color by default in all the Browsers. Syntax: It returns the disabled pro
2 min read
Article Tags :