Try jQuery focus method, e.g.
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("input:text").focus(function(){
alert($(this).attr('id'));
});
});
</script>
</head>
<body>
<input type="text" id="textbox1" value="">
<input type="text" id="textbox2" value="">
</body>
</html>