Open In App

HTML DOM Input Search blur() Method

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. 




<!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

Supported Browsers: 


Article Tags :