jQuery event.result Property

Beginner
5 min read
Updated: Nov 2026
3 examples
Events

Definition

event.result holds the last non-undefined value returned by a handler that ran earlier during the same event dispatch. Later handlers can read it. Especially useful for custom events. Available since jQuery 1.3.

Syntax

Start with these common calls. Keep them short and readable.

jQuery
event.result   // last non-undefined handler return (same dispatch)

$("button").on("click", function () {
  return "hey";                 // stored on event.result
});
$("button").on("click", function (event) {
  console.log(event.result);    // "hey"
});

// Returning undefined does NOT clear a previous result
CallWhat it does
event.resultLearn jQuery event.result: last non-undefined return from a prior handler on the same dispatch, official two-handler click demo, validation chains, custom events, vs event.data, examples, pitfalls, and FAQs.

Load jQuery before your script (CDN or local file), then wrap DOM work in $(function () { ... }) when needed.

Parameters

ParameterDescription
Step 1Bind two (or more) handlers on the same element and event.
Step 2In an earlier handler, return a non-undefined value.
Step 3In a later handler, read event.result.

Return Value

Return ValueDescription
jQuery objectMost setters and traversing helpers return the jQuery collection so you can chain more methods.
Value / undefinedGetters usually return a value from the first matched element, or undefined when nothing applies.

jQuery Examples

Example 1 — Official Demo: Show Prior Return

First handler returns "hey"; second displays event.result.

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

$("button").on("click", function (event) {
  $("#out").text(event.result);
});
Try It Yourself

How It Works

  1. First handler. Returns the string "hey".
  2. Store. jQuery sets event.result to that value.
  3. Second handler. Runs next on the same click.

Example 2 — Validation Chain

Return an error string from the first handler; show it in the second.

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) {
    $("#out").text(event.result);
  } else {
    $("#out").text("Looks good");
  }
});
Try It Yourself

How It Works

  1. Validate. First handler checks the email.
  2. Error. Returns a message string when invalid.
  3. OK. Returns nothing (undefined) when valid.

Example 3 — undefined Does Not Overwrite

A middle handler with no return leaves the first result intact.

jQuery
$("button").on("click", function () {
  return "first";
});

$("button").on("click", function () {
  // returns undefined — does not clear result
});

$("button").on("click", function (event) {
  $("#out").text("result: " + event.result);
});
Try It Yourself

How It Works

  1. Set. First handler returns "first".
  2. Skip. Second returns undefined — no overwrite.
  3. Read. Third still sees "first".

Frequently Asked Questions

event.result 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. Useful for passing values between handlers, especially on custom events.
Each handler can return a value, but only the most recent non-undefined return is stored on event.result for later handlers. The next handler does not get the return as an argument — it reads event.result.
Bind two click handlers on a button. The first returns "hey". The second sets a paragraph’s HTML to event.result — displaying hey.
No. jQuery updates event.result only when a handler returns a value that is not undefined. A middle handler that returns undefined leaves the previous result intact.
Yes. When you .trigger() a custom event, handlers run in order and can pass data forward via return values. Later handlers read event.result — useful for plugin pipelines.
No. event.data is set at bind time with .on("click", { id: 1 }, fn). event.result is a return value from an earlier handler during dispatch. They are separate channels.

Next: event.timeStamp Property

Read when the browser created the event and measure click deltas.

event.timeStamp Property tutorial →

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

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.

9 people found this page helpful