<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type = "text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
var focusControl;
$("input, select, textarea").live("focus", function () {
focusControl = $(this);
});
$("#btnDemo").live("click", function () {
if (focusControl.length > 0) {
alert("Id: " + focusControl.attr("id") + " TagName: " + focusControl[0].tagName);
} else {
alert("No control has focus");
}
});
</script>
</head>
<body>
<form id="form1">
<input type = "text" id = "text1" />
<textarea id = "textarea1" rows = "1" cols = "1"></textarea>
<select id = "dropdown">
<option>a</option>
<option>b</option>
</select>
<input id = "btnDemo" type = "button" value = "Get Focus Control" />
</form>
</body>
</html>