jQuery event.target Property

Beginner
6 min read
Updated: Oct 2026
5 examples
Live preview

What Is event.target?

event.target is the DOM element that initiated the event — often a descendant of the element that registered the handler. Since jQuery 1.0. Compare with this to detect bubbling, and use it for event delegation. Contrast with currentTarget (handler element) and relatedTarget (other element on mouse enter/leave).

Remember
event.target          // Element that started the event
event.currentTarget   // Element whose handler is running
this                  // Usually === currentTarget

// Official pattern — log the tag name
$("body").on("click", function (event) {
  $("#log").html("clicked: " + event.target.nodeName);
});
NeedUse
Who was clicked?event.target
Whose handler is running?event.currentTarget
Where was .on() attached?event.delegateTarget
Other element (mouse in/out)event.relatedTarget
Bind handlers.on()

How to Use event.target

Read it inside any handler to learn where the event started.

  1. Bind with .on() on a parent or the element itself.
  2. Inside the handler, read event.target (native Element).
  3. Optionally wrap: $(event.target) for .is() / .closest().
  4. Compare to this when you need “direct vs bubbled”.
  5. Act only when the target matches the control you care about.
PieceRequired?Role
event argumentYesjQuery event object
event.targetYes (to inspect origin)Deepest initiating element
$(event.target)OptionaljQuery methods on the origin
event.target === thisOptionalDetect direct vs bubbled click

Pseudocode

Pseudocode
parent.on("click", handler)

when click anywhere under parent:
    target = deepest element clicked
    currentTarget / this = parent (or matched delegate)

    if target === this:
        direct click on parent
    else:
        bubbled from a child (target)

    // Delegation: filter with $(target).is("li") or .closest(".tool")

Cheat Sheet

Keep these facts handy while reading event origins.

TopicDetail
TypeProperty → Element
SincejQuery 1.0
MeaningElement that initiated the event
May beBound element or a descendant
vs thisEqual on direct click; differ when bubbled
DelegationInspect with .is() / .closest()

Live Preview

Click each block — the log shows event.target.nodeName, like the official demo.

Click
span block strong block

paragraph block

One handler logs event.target.nodeName for whoever you click.

Log
Click span, strong, or paragraph.

jQuery Examples

Short labs — each has View Output, Try It Yourself, and How It Works.

Example 1 — Official nodeName Log

Click nested blocks; log the initiating tag.

jQuery
$("body").on("click", function (event) {
  if ($(event.target).closest("#out").length) return;
  $("#out").text("clicked: " + event.target.nodeName);
});
Try It Yourself

How It Works

  1. Body handler. One listener for the whole page.
  2. Skip the log. Ignore clicks on the output itself.
  3. Read target. nodeName is the tag in uppercase.
  4. Takeaway. Origin can differ from the bound element.

Example 2 — Official ul Delegation Toggle

Click an li to toggle its nested list — official pattern.

jQuery
function handler(event) {
  var target = $(event.target);
  if (target.is("li")) {
    target.children("ul").toggle();
  }
}

$("ul").first().on("click", handler).find("ul").hide();
Try It Yourself

How It Works

  1. One bind. Handler sits on the outer ul.
  2. Filter. Act only when target.is("li").
  3. Toggle. Show/hide that row’s child ul.
  4. Hide first. Nested lists start collapsed.

Example 3 — target vs currentTarget

Click the icon inside a button — origins differ.

jQuery
$("#save").on("click", function (event) {
  $("#out").text(
    "target: " + event.target.tagName +
    " | currentTarget: #" + event.currentTarget.id
  );
});
Try It Yourself

How It Works

  1. Handler on button. currentTarget stays #save.
  2. Icon click. Deepest node is the SPAN.
  3. Button click. Target can be the button itself.
  4. Rule. Target = origin; currentTarget = handler owner.

Example 4 — target vs this

Detect direct panel click vs bubbled child click.

jQuery
$("body").on("click", "#panel", function (event) {
  if (event.target === this) {
    $("#out").text("Direct click on #panel");
  } else {
    $("#out").text("Bubbled from " + event.target.tagName);
  }
});
Try It Yourself

How It Works

  1. Delegated panel. this is #panel.
  2. Equal. Background click → target === this.
  3. Unequal. Child click → event bubbled up.
  4. API tip. Official docs recommend this comparison for bubbling.

Example 5 — Toolbar with .closest()

Resolve the tool even when the click hits a nested icon.

jQuery
$("#toolbar").on("click", ".tool", function (event) {
  var tool = $(event.target).closest(".tool");
  $("#out").text("Activated: " + tool.data("action"));
});
Try It Yourself

How It Works

  1. Delegate. One handler for all .tool buttons.
  2. Icon click. Target may be the inner span.
  3. Climb. .closest(".tool") finds the button.
  4. Action. Read data-action from that button.

Edge Cases & Pitfalls

Watch for these when reading event origins.

wrap

Not a jQuery object

event.target.is fails — wrap first: $(event.target).is("li").

nested

Icons and labels

Clicks often hit a child span. Use .closest() to reach the control.

vs

Confused with currentTarget

Target = who started it. CurrentTarget = whose handler ran. They match only on direct clicks.

mouse

Not relatedTarget

relatedTarget is the other element on mouseover/mouseout — different property.

Browser Support

event.target is a standard DOM Event property. jQuery exposes it on the normalized event object since 1.0. Works wherever your loaded jQuery version runs.

✓ Stable · Event property

event.target

Supported in all modern browsers via the DOM Event API. Prefer jQuery 3.x for a consistent event object with target, currentTarget, and delegateTarget.

100% Property support
Google Chrome All versions · Desktop & Mobile
Full support
Mozilla Firefox All versions · Desktop & Mobile
Full support
Apple Safari All versions · macOS & iOS
Full support
Microsoft Edge All versions · Chromium & Legacy
Full support
Internet Explorer IE 6+ · Legacy environments
Full support
Opera All modern versions
Full support
target Universal

Bottom line: Safe for production. Use target for the click origin; use currentTarget for the handler element; use closest() when icons nest inside buttons.

Performance Notes

ApproachCostBest for
Read event.targetFreeIdentifying the origin
$(event.target)Tiny wrapCalling jQuery methods
One parent + filterCheapMenus, lists, toolbars
Bind every childHeavierAvoid when the list is large/dynamic

Reading target has no meaningful cost. Prefer one delegated parent handler that filters with .is() / .closest() over binding every child.

Key Takeaways

  • Role: the element that initiated the event.
  • vs this: equal on direct click; differ when bubbled.
  • Delegation: filter with .is() or .closest().
  • Native: wrap with $() only when needed.

One line: event.target answers “which element started this event?”

Frequently Asked Questions

event.target is the DOM element that initiated the event — the deepest element the user interacted with. Available since jQuery 1.0. It is a native Element, not a jQuery collection.
event.target is where the event started. event.currentTarget is the element whose handler is running. Click a span inside a button: target is the span; currentTarget on the button handler is the button.
When event.target === this, the user interacted with the bound element itself. When they differ, the event bubbled from a descendant — useful for nested icons, links inside rows, or panel backgrounds.
Bind one handler on a parent, then inspect $(event.target) with .is(), .closest(), or a selector filter before acting. The official ul demo uses target.is("li") to toggle nested lists only when an li was clicked.
No. event.target is the element for the current event. event.relatedTarget is the other element in mouseover/mouseout transitions. relatedTarget is for mouse enter/leave style events; target applies to all event types.
Only when you want jQuery methods. event.target.nodeName is fine on the native element. Use $(event.target).is("li") or .closest(".tool") when you need the jQuery API.

Next: event.data

Pass and read custom data from your .on() bindings.

event.data tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

10 people found this page helpful