<html>
<body onclick="myFunction(event)">
<h1>The Element Object</h1>
<h2>The tagName Property</h2>
<p>Click on any elements in this document to see which element triggered the onclick event.</p>
<button>This is a button</button>
<p><span>This is span element.</span></p>
<p id="demo"></p>
<script>
function myFunction(event) {
const element = event.target;
document.getElementById("demo").innerHTML = "Triggered by " + element.tagName;
}
</script>
</body>
</html>