jQuery event.result

Beginner
⏱️ 8 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
Event object · jQuery 1.3+

What You’ll Learn

event.result stores the last non-undefined return value from a handler that ran earlier during the same event dispatch on the same element. This tutorial covers the official two-handler click demo, validation chains, undefined guard behavior, custom event pipelines, and comparing with event.data and $.trigger.

01

Property

event.result

02

Returns

Object (any)

03

Official

return “hey”

04

Chain

Prior handler output

05

undefined

Does not overwrite

06

Since 1.3

All event types

Introduction

When multiple handlers are bound to the same element and event, jQuery runs them in registration order during one dispatch. Each handler can return a value — and jQuery exposes the most recent non-undefined return to later handlers as event.result.

Unlike event.data (bind-time payload) or the second argument to $.trigger() (trigger-time payload), event.result captures what an earlier handler returned during execution. jQuery has forwarded it since version 1.3 — especially useful for custom events and handler chains on the same element.

Understanding event.result

This property answers one question: what did the previous handler in this dispatch return?

  • Same dispatch — only handlers on the same element, same event, same trigger count.
  • Last non-undefined — returning undefined (or nothing) does not replace an earlier result.
  • Read-only — a property on the event object; not a method.
  • Any type — strings, numbers, objects, or false to signal cancellation in some patterns.
💡
Beginner Tip

In the official jQuery demo, the first click handler return "hey" and the second reads event.result to fill a paragraph — no shared variables or closures needed.

📝 Syntax

Official jQuery API form (since 1.3):

jQuery
event.result

// typical pattern:
$( "button" ).on( "click", function () {
  return "hey";
});
$( "button" ).on( "click", function ( event ) {
  $( "p" ).html( event.result );
});

Parameters

  • Noneresult is a property, not a function.

Return value

  • Object — the last non-undefined value returned by a prior handler on this dispatch, or undefined if none returned a value yet.

Official jQuery API example

jQuery
$( "button" ).on( "click", function ( event ) {
  return "hey";
});
$( "button" ).on( "click", function ( event ) {
  $( "p" ).html( event.result );
});

⚡ Quick Reference

ScenarioWhat event.result holdsCommon use
First handler returns stringAvailable to second handlerOfficial “hey” demo
Handler returns undefinedPrevious result keptSkip steps in pipeline
Validation chainError message from validatorDisplay in UI handler
Custom .trigger()Accumulated plugin statusMulti-plugin hooks
No prior returnundefinedGuard before use

📋 event.result vs handler return vs event.data vs $.trigger

Four ways data moves through jQuery events — each channel serves a different purpose.

event.result
event.result

Prior handler return (same dispatch)

Handler return
return "value";

Sets result for next handler

event.data
.on("click", { id: 1 }, fn)

Bind-time payload object

$.trigger arg
.trigger("evt", [data])

Trigger-time extra arguments

Examples Gallery

Example 1 follows the official jQuery click demo. Examples 2–5 cover validation chains, undefined guard behavior, custom event pipelines, and a four-way comparison with event.data.

📚 Official jQuery Demo

Two click handlers on one button — first returns a string, second displays event.result.

Example 1 — Official Demo: display previous handler’s return

Official jQuery demo — first handler returns "hey", second sets paragraph HTML from event.result.

jQuery
$( "button" ).on( "click", function ( event ) {
  return "hey";
});
$( "button" ).on( "click", function ( event ) {
  $( "p" ).html( event.result );
});
Try It Yourself

How It Works

Handlers run in bind order. The first return "hey" sets event.result before the second handler executes — matching the official API demo exactly.

Example 2 — Validation chain: error string via event.result

First handler validates input and returns an error message; second handler displays it if present.

jQuery
$( "#submit" ).on( "click", function () {
  var val = $( "#email" ).val();
  if ( !val || val.indexOf( "@" ) === -1 ) {
    return "Invalid email address";
  }
});
$( "#submit" ).on( "click", function ( event ) {
  if ( event.result ) {
    $( "#error" ).text( event.result ).show();
  } else {
    $( "#error" ).hide();
  }
});
Try It Yourself

How It Works

The validator returns an error string only on failure. The UI handler reads event.result — a clean separation without shared module state.

📈 Practical Patterns

Undefined guard behavior, custom event pipelines, and channel comparison.

Example 3 — undefined return does not overwrite

Three handlers — middle handler returns nothing; third still sees the first handler’s value.

jQuery
$( "button" ).on( "click", function () {
  return "first";
});
$( "button" ).on( "click", function () {
  // implicit undefined — does not overwrite
});
$( "button" ).on( "click", function ( event ) {
  $( "#log" ).text( "result: " + event.result );
});
Try It Yourself

How It Works

jQuery only updates event.result when a handler returns a value that is not undefined. The middle handler’s empty return preserves "first".

Example 4 — Custom event: accumulated status via returns

Plugin-style handlers on a custom event each return an updated status object; final handler reads event.result.

jQuery
$( "#widget" ).on( "beforeSave", function () {
  return { step: 1, msg: "validated" };
});
$( "#widget" ).on( "beforeSave", function ( event ) {
  var prev = event.result || {};
  return { step: prev.step + 1, msg: prev.msg + ", enriched" };
});
$( "#widget" ).on( "beforeSave", function ( event ) {
  $( "#log" ).text( JSON.stringify( event.result ) );
});
$( "#go" ).on( "click", function () {
  $( "#widget" ).trigger( "beforeSave" );
});
Try It Yourself

How It Works

Each handler reads event.result, transforms it, and returns the next state — a lightweight pipeline for custom events without a central coordinator.

Example 5 — Compare event.result vs event.data vs direct return

Log all three channels on one click — bind-time data, prior return, and trigger payload.

jQuery
$( "#btn" ).on( "click", { source: "bind" }, function () {
  return "from-return";
});
$( "#btn" ).on( "click", { source: "bind" }, function ( event ) {
  var lines = [
    "event.data.source: " + event.data.source,
    "event.result: " + event.result
  ];
  $( "#log" ).html( lines.join( "
" ) ); }); // programmatic trigger with extra arg: $( "#trigger" ).on( "click", function () { $( "#btn" ).trigger( "click", [ { source: "trigger" } ] ); });
Try It Yourself

How It Works

event.data comes from .on() binding; event.result from an earlier handler’s return; $.trigger(…, [data]) passes trigger-time args — three independent channels.

🚀 Common Use Cases

  • Validation pipelines — validator returns error string; UI handler reads event.result.
  • Custom event hooks — plugins return status objects for downstream handlers.
  • Multi-step widgets — accumulate computed values across handlers on one element.
  • Cancel patterns — early handler returns false; later handlers inspect result.
  • Testing triggers — simulate handler chains without shared globals.
  • Legacy plugin APIs — read previous plugin return on the same dispatch.

🧠 How event.result Works

1

Event dispatch starts

User click or .trigger() runs all handlers bound to the element in registration order.

Dispatch
2

First handler returns

If the return value is not undefined, jQuery stores it on event.result.

Return
3

Later handlers read result

Each subsequent handler sees the latest non-undefined return via event.result.

Read
4

Handler chain complete

Validation messages, plugin status, or official demo text — passed forward without closures or globals.

📝 Notes

  • Available since jQuery 1.3 — returns an Object (any non-undefined return type).
  • Read-only property — set indirectly by prior handler returns during dispatch.
  • Only the last non-undefined return is stored — not every handler’s return history.
  • Returning undefined (or nothing) does not overwrite a previous result.
  • Scoped to the same element and event on one dispatch — not cross-element.
  • Not the same as event.data or $.trigger() second argument — see Compare section.

Browser Support

event.result is a jQuery event object property since jQuery 1.3+. It is implemented entirely in jQuery’s event dispatch — not a native DOM property — and works consistently in all browsers jQuery supports.

jQuery 1.3+ · all browsers

jQuery event.result

Last non-undefined handler return on the same dispatch.

100% Universal
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
result Object (any)

Bottom line: Read event.result in later handlers — prior non-undefined return from the same dispatch.

Conclusion

event.result exposes the last non-undefined return from an earlier handler on the same dispatch — the official demo passes "hey" from the first click handler to the second via this property.

Use it for validation chains, custom event pipelines, and plugin hooks — and always distinguish it from bind-time event.data and trigger-time $.trigger arguments.

💡 Best Practices

✅ Do

  • Guard: if (event.result) { … } before use
  • Return meaningful values from early handlers in a chain
  • Use for custom events and plugin pipelines on one element
  • Return false explicitly when you mean to signal cancel
  • Document handler order when relying on event.result

❌ Don’t

  • Call event.result() with parentheses
  • Expect result from handlers on a different element
  • Confuse event.result with event.data
  • Assume every handler return is stored — only last non-undefined
  • Assign to event.result directly — it is set by jQuery

Key Takeaways

Knowledge Unlocked

Five things to remember about result

Prior handler return on the same dispatch.

5
Core concepts
hey 02

Official

Two-handler demo

Demo
03

undefined

Does not overwrite

Guard
data 04

event.data

Bind-time payload

Compare
evt 05

Custom

Plugin pipelines

Pattern

❓ Frequently Asked Questions

event.result is a property on the jQuery event object. It holds the last non-undefined value returned by a handler that ran earlier during the same event dispatch on the same element. Available since jQuery 1.3.
Each handler can return a value, but only the most recent non-undefined return is stored on event.result for later handlers in the chain. The second handler does not receive the first handler's return directly — it reads event.result.
The official API example binds two click handlers on a button. The first returns the string "hey". The second sets a paragraph's HTML to event.result — displaying hey.
No. jQuery only updates event.result when a handler returns a value that is not undefined. A middle handler that returns undefined leaves the previous result intact for subsequent handlers.
Yes. When you .trigger() a custom event, handlers bound with .on() run in order and can pass data forward via return values. Later handlers read the accumulated value from event.result — useful for plugin pipelines.
No. event.data is the object passed at bind time with .on('click', { id: 1 }, fn). event.result is the return value from an earlier handler during dispatch. $.trigger('evt', [payload]) supplies trigger-time data — a third, separate channel.
Did you know?

The official jQuery event.result demo uses two click handlers on the same button — the first return "hey" and the second reads event.result to set paragraph HTML, proving handler return values flow forward without shared variables.

Next: event.timeStamp

Measure time between events and profile handler performance with the event creation timestamp.

event.timeStamp 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.

6 people found this page helpful