Skip to content
Related Articles

Related Articles

Improve Article

HTML | DOM blur() Method

  • Last Updated : 25 Jul, 2019

The DOM blur method is used to remove the keyboard focus from the current element and also give focus with the help of focus() method. We can apply the blur to any element and enable it by doing some operation. For example, we can blur to text-box by clicking a button.




    <title>HTML DOM blur Property</title>
<body style="text-align: center;">
    <h1 style="color:green;">
            DOM blur Property
    <input type="text" id="txt" placeholder="Enter text here">
    <button type="button" onclick="inputFocus()">Focus</button>
    <button type="button" onclick="inputBlur()">Blur</button>
        function inputFocus() {
        function inputBlur() {

After clicking on focus button:

After clicking on blur button:

Supported Browsers: The browser supported by blur() method are listed below:

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

Attention reader! Don’t stop learning now. Get hold of all the important Comcompetitivepetitve Programming concepts with the Web Design for Beginners | HTML  course.

My Personal Notes arrow_drop_up
Recommended Articles
Page :