Tutorialspoint.dev

jQuery | event.result Property with Examples

The event.result is an inbuilt property in jQuery 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.
Return Value: It returns the last and previous value returned by an event handler started by the specified event.

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

<html>
  
<head>
    </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:
Before clicking the button-

After clicking the button-



This article is attributed to GeeksforGeeks.org

You Might Also Like

leave a comment

code

0 Comments

load comments

Subscribe to Our Newsletter