Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<body onclick="myFunction(event)">
<p>Click on a paragraph. An alert box will alert the element whose eventlistener triggered the event.</p>
<p><strong>Note:</strong> The currentTarget property does not necessarily return the element that was clicked on, but the element whose eventlistener triggered the event.</p>
<script>
function myFunction(event) { 
  alert(event.currentTarget.nodeName);
}
</script>
</body>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=try_dom_event_currenttarget by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 21 Dec 2022 17:40:08 GMT -->
</html>