Hello Readers,
Jquery blur is the jquery method which is used to attach the function to the jquery event and the function get executed to a given element after the event occurs. Event lose the focus when we click on input field and it performs the action.
Syntax :
$(selector).blur( function () { do some useful work });
For Example :
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("input").blur(function(){
$(this).css("background-color", "#ffffff");
});
});
</script>
</head>
<body>
Name: <input type="text" name="fullname"><br>
Email: <input type="text" name="email">
</body>
</html>
In the above example, blur method work on Css Event when we click on input field it change its background color.
0 Comment(s)