<!DOCTYPE html>
<html>
<head>
<title>jQuery focus() method</title>
<script src="jquery-latest.min.js"></script>
<script>
$(document).ready(function(){
$(".btn1").click(function(){
$("input").focus();
$("input").css("background-color", "yellow");
});
$(".btn2").click(function(){
$("input").blur();
$("input").css("background-color", "white");
});
});
</script>
</head>
<body>
<button class="btn1">focus event</button>
<button class="btn2">blur event</button>
<br /><br />
<div>
Name: <input type="text" name="name" />
</div>
</body>
</html>