jQuery | event.type property with Examples

The event.type is an inbuilt property in jQuery which is used to return which event type is started.
Syntax:

event.type

Parameter: It does not accept any parameter because it is a property not a function.
Return Value : It returns which event type has been triggered.
jQuery code to show the working of event.type property:

filter_none

edit
close

play_arrow

link
brightness_4
code

<html>
  
<head>
    <!-- jQuery code to show the working of this property -->
    </script>
    <script>
        $(document).ready(function() {
            $("#div1").on("click dblclick mouseover mouseout",
            function(event) {
                $(".div2").html("Event: " + event.type);
            });
        });
    </script>
    <style>
        #div1 {
            width: 230px;
            height: 100;
            display: block;
            padding: 25px;
            border: 2px solid green;
            font-size: 20px;
        }
          
        .div2 {
            width: 170px;
            margin: 10px;
            height: 50px;
            padding: 10px;
            border: 2px solid green;
        }
    </style>
</head>
  
<body>
    <!-- move mouse over this box -->
    <div id="div1">Do any event in this box !!</div>
    <!-- events are being shown in this box -->
    <div class="div2"></div>
</body>
  
</html>

chevron_right


Output:
Before moving mouse anywhere-



After the mouse is moved over the big box-

After the mouse is moved outside of the big box-



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.