jQuery Event - target attribute
Example
Show which DOM element triggered the event:
$("p, button, h1, h2").click(function(event){ $("div").html("Triggered by a " + event.target.nodeName + " element."); });
Definition and Usage
The target attribute specifies which DOM element triggered the event.
Syntax
event.target
Parameter | Description |
---|---|
event | Required. Specifies the event to be checked. This event Parameters come from the event binding function. |