jQuery blur() Method

By: Bipin C Mathew 9 months ago

The Blur is a Jquery Event Method. It occur when elements loses there focus. We can use blur with focus method. This event was commonly used only for elements of the form such as <input>. It has been expanded to include all types of elements in recent browsers.

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

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


	<!doctype html>
	<html lang="en">
			<meta charset="utf-8">
			<script src="https://code.jquery.com/jquery-3.4.1.js"></script>
					alert("This text box has lost its focus.");  

			Enter any value: <input type="text">  


In this code jquery is started with $(document).ready(function() . It is used to identify Document Object Model (DOM) is ready for JavaScript code to execute. The $("input").blur(function() function help to add blur method in all input fields. When we click outside the textbox we got an alert"This text box has lost its focus".


Let us talk!

We take the vision which comes from dreams and apply the magic of science and mathematics, adding the heritage of our profession and our knowledge to create a design.