jQuery: blur() method
Giải phóng thời gian, khai phóng năng lực
Phương thức blur() ngược với phương thức focus(), nghĩa là khi bạn không còn focus vào phần tử HTML hiện tại nữa thì phương thức blur() sẽ được kích hoạt.
Ví dụ:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="http://ajax.googleapis. com/ajax/libs/jquery/1.11.0 /jquery.min.js">
</script>
<script>
$(function(){
$("#in1").focus(function(){
$(this).css("background", "red");
});
$("#in1").blur(function(){
$(this).css("background", "green");
});
});
</script>
<style>
#in1{
width:20%; color:white;
}
</style>
</head>
<body>
<input id="in1" accesskey="C" placeholder="Focus tôi => Tôi red. Blur tôi => Tôi green">
</body>
</html>
Giải phóng thời gian, khai phóng năng lực