jQuery event.result Property


The event.result property in jQuery has the last/previous value returned by an event handler triggered by the specified event.

Syntax

The syntax is as follows −

event.result

Example

Let us now see an example to implement the jQuery event.result property −

<!DOCTYPE html>
<html>
<head>
<style>
   .demo {
      color: orange;
      background-color: black;
   }
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
   $(document).ready(function(){
      $("button").click(function(){
         return "New text generated!";
      });
      $("button").click(function(event){
         $("p").html(event.result);
      });
   });
</script>
</head>
<body>
<h2 class="demo">Heading Two</h2>
<button>Click me</button>
<p>This is a demo line.</p>
</body>
</html>

Output

This will produce the following output. This is before clicking the button −

Click the button above −

Updated on: 12-Nov-2019

58 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements