Get clicked element
Description
The following code shows how to get clicked element.
Example
<html>
<head>
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {<!-- w w w .j a v a 2s. c o m-->
$("*", document.body).click(function(e) {
e.stopPropagation();
var domEl = $(this).get(0);
$("span:first").text("Clicked on - " + domEl.tagName);
});
});
</script>
</head>
<body>
<span></span>
<p>A</p>
<div>B</div>
</body>
</html>