Home >>jQuery Tutorial >jQuery event.target Property

jQuery event.target Property

jQuery event.target Property

jQuery event.target property in jQuery is used to returns which DOM element triggered the event and useful to compare event.target to this in order to determine if the event is being handled due to event bubbling.

Syntax:
event.target

Parameter Values

Parameter Description
event It is a required parameter and is used to the event parameter comes from the event binding function
Here is an Example of jQuery event.target Property:

<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$(".para, .btn1, .head").click(function(event){
$(".box").html("It is Triggered by a " + event.target.nodeName + " element.");
});
});
</script>
</head>
<body>
<h1 class="head">This is Phptpoint</h1>
<p class="para">This is first paragraph</p>
<button class="btn1">Click me</button>
<div class="box" style="color:red;"></div>
</body>
</html>

Output:

This is Phptpoint

This is first paragraph


No Sidebar ads