event.result Property - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:event.result

Description

The event.result property contains the previous value returned by an event handler.

Syntax

Parameter RequireDescription
event Required. The event parameter comes from the event binding function

The following code shows how to Return the value of the previous click event:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $("button").click(function(){
        return "Hello world!";
    });/*www .  j  av a  2  s . com*/
    $("button").click(function(event){
        $("p").html(event.result);
    });
});
</script>
</head>
<body>

<button>Click me to display event.result</button>

<p>This is a paragraph.</p>


</body>
</html>

Related Tutorials