JQuery blur

 

The blur() method occurs when element loss focus. In this blur() method we are used to remove focus from the selected element. This method start the blur event or it can be attached a function to run when a blur event occurs.

Syntax:

Trigger the blur event for the selected elements: $(selector).blur()

Attach a function to the blur event: $(selector).blur(function)

 
 
 
<html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script> <script> $(document).ready(function() { $(".btn").click(function() { $("input").blur(); $("p").html("This is blur method that is used!!!"); }); }); </script> </head> <body> Enter your Name: <input type="text"> <br> <br> <button class="btn">get blur!!!</button> <p style="color:gray"></p> </body> </html>
Output