Open In App

HTML DOM Input URL blur() Method

Last Updated : 13 Feb, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

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

Syntax:

urlObject.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 URL blur()  method in HTML DOM.  

HTML




<!DOCTYPE html>
<html>
  
<head>
    <title>
        HTML DOM Input URL blur() Method
    </title>
</head>
  
<body style="text-align:center;">
  
    <h1 style="color:green">GeeksforGeeks</h1>
  
    <strong>DOM Input URL blur() method</strong>
    <form id="myForm">
       <input type="URL" 
              id="url_id" name="Lnk">
    </form>
    <br>
    <button onclick="myblur()">Remove Focus!</button>
    <!-- script to clear focus to the URL field-->
    <script>
        function myblur() {
            var txt = document.getElementById("url_id").blur();
        }
    </script>
</body>
</html>


Output 

Supported Browsers: The list of browsers supported by the HTML DOM Input URL blur() method is given below.

  • Google Chrome
  • Mozilla Firefox
  • Internet Explorer
  • Opera
  • Safari

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads