Open In App

jQuery event.result Property

Improve
Improve
Like Article
Like
Save
Share
Report

The jQuery event.result is an inbuilt property which is used to find the last and previous value returned by an event handler started by the specified event. 

Syntax:

event.result

Parameter: It does not accept any parameter because it is a property not a function. 

Example 1: jQuery code to show the working of event.result property.

HTML




<!DOCTYPE html>
<html>
  
<head>
    <script src=
    </script>
    <style>
        div {
            width: 40%;
            height: 100px;
            margin: 10px;
            padding: 10px;
            display: block;
            border: 2px solid green;
        }
    </style>
</head>
  
<body>
    <div>
        <!-- click on this button -->
        <button>Click here for event result</button>
        <p></p>
    </div>
    <!-- jQuery code to show working of this property -->
    <script>
        $("button").click(function (event) {
            return "Geeks for Geeks !";
        });
        $("button").click(function (event) {
            $("p").html(event.result);
        });
    </script>
</body>
  
</html>


Output:

 

Example 2: In this example, a pop-up will show last value returned by an event handler.

HTML




<!DOCTYPE html>
<html>
  
<head>
    <script src=
    </script>
</head>
  
<body>
    <center>
        <div>
            <!-- click on this button -->
            <button>Click here for event result</button>
        </div>
        <!-- jQuery code to show working of this property -->
        <script>
            $("button").click(function (event) {
                return "Geeks for Geeks !";
            });
            $("button").click(function (event) {
                alert(event.result);
            });
        </script>
    </center>
</body>
  
</html>


Output:

 



Last Updated : 03 Jul, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads