<!DOCTYPE html>
<html lang="en-US">
<head>
<style>
button, textarea, input{
display:block;
margin:10px 0px;
}
</style>
</head>
<body onclick="myFunction()">
<p>Click on any Element to display the active element of this document.</p>
<button>Click Me</button>
<textarea cols="20" rows="3">Click Me</textarea>
<input type="text" value="focus me">
<p id="point"></p>
<script>
var x = document.getElementById("point");
function myFunction(){
x.innerHTML = document.activeElement.tagName;
}
</script> </body>
</html>