Javascript Ajax jQuery Html PHP Example Quiz New MORE

jQuery blur() Method

The blur event occurs when we come out from an input box. The blur() is an inbuilt method in jQuery. When we come out from an input box it's lost its focus.

Example: In password match we can use the blur() function to get instant that the password is wrong or right.

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

Example:

	<!DOCTYPE html>
	<html>
	<head>
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
	<script>
	$(document).ready(function(){
	  $("input").blur(function(){
		var result=$("input").val();
		alert("Enter value is value is:"+result);
	  });
	});
	</script>
	</head>
	<body>

	Enter Anything: <input type="text">
	<p>Write anything in the input field, and come out from the input box.</p>

	</body>
	</html>
Run it Yourself »