×

jQuery Tutorial

jQuery Examples

jQuery Practice

jQuery event.result Property

jQuery | event.result Property: Learn about the jQuery event.result Property with its usages, syntax, and examples.
Submitted by Pratishtha Saxena, on October 28, 2022

event.result Property

An event is an action occurred by the user. Therefore, many functions and methods can be set according to those actions performed. When these actions are defined for an event interface, we term those as the event properties. There are various predefined event properties in jQuery. Here, let's discuss the event.result property.

The event.result is a built-in property in jQuery. This property provides us with the result/value of the previous event handler for that specific event. If the last event handler returns something as its result, then using event.result we can access that value.

The point to keep in mind is that this only works for the same events, i.e., if the last event handler was attached to a click, then we can access that value for the next click only.

event.result Property Syntax

event.result

This method does not accept any parameters. It will return the value returned by the previous event handler. The below example shows that event.result displays the value on the hover event.

jQuery event.result Property Example

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
    <title>Document</title>
  </head>
  
  <body>
    <h2>jQuery Event - Result Property</h2>
    <p>Hover the following sentences to implement the <b>event.result property</b> in jQuery.</p>
    <hr>
    <h4 style="color:darkblue">Welcome to Include Help !</h4>
    <p>This is a jQuery Tutorial for Event Methods.
    <div>Here we are discussing about <b>event.result</b> property.</div>
    </p>
    <h4 style="color:darkblue">Thanks for visiting !</h4>
    <hr>
    <h3></h3>
  
  </body>
  <script type="text/javascript">
    $(document).ready(function(){
        $('h4, div, p').hover(function(){
            return 'Hovered';
        });
        $('h4, div, p').hover(function(event){
            $('h3').html(event.result);
        });
    });
  </script>
</html>

Output:

Example 1: jQuery event.result Property


Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.