Skip to content
Related Articles

Related Articles

HTML DOM Input URL blur() Method

View Discussion
Improve Article
Save Article
Like Article
  • Last Updated : 13 Feb, 2022

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
My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!