Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

jQuery event.result Property

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

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:

 


My Personal Notes arrow_drop_up
Last Updated : 17 Nov, 2022
Like Article
Save Article
Similar Reads