Open In App

HTML DOM Input Search blur() Method

Last Updated : 25 Aug, 2022
Comments
Improve
Suggest changes
Like Article
Like
Report

The Input Search blur() method in HTML DOM is used to extract or remove focus from the search field when the event occurs.  

Syntax:

searchObject.blur()

Parameters: This method does not contain any parameter values.

Return Value: It does not return any value.

Example: Below program illustrates the use of the input search blur()  method in HTML DOM. 

HTML




<!DOCTYPE html>
<html>
<head>
    <title>
        Input Search blur() Method
    </title>
</head>
<body style="text-align:center">
    <h2 style="color:green">GeeksforGeeks</h2>
    <strong>Input Search blur() Method</strong>
    <form id="myGeeks">
        <input type="Search"
            id="test"
            name="myGeeks"
            placeholder="Type to search.."
            value="GeeksForGeeks"
            autofocus>
    </form>
    <br>
    <br>
    <button onclick="Blur()">
       clear Focus
    </button>
    <script>
        function Blur() {
 
            // remove focus from the Input Search field
            var s = document.getElementById(
                "test").blur();
        }
    </script>
</body>
</html>


Output: 

HTML DOM Input Search blur() Method

HTML DOM Input Search blur() Method

Supported Browsers: 

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


Next Article

Similar Reads