event.result


event.resultReturns: Object

Description: The last value returned by an event handler that was triggered by this event, unless the value was undefined.

  • version added: 1.3event.result

This property can be useful for getting previous return values of custom events.

Example:

Display previous handler's return value

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>event.result demo</title>
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
</head>
<body>
<button>display event.result</button>
<p></p>
<script>
$( "button" ).on( "click", function( event ) {
return "hey";
});
$( "button" ).on( "click", function( event ) {
$( "p" ).html( event.result );
});
</script>
</body>
</html>

Demo: