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.


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:

    <!-- jQuery code to show the working of this property -->
        $(document).ready(function() {
            $("#div1").on("click dblclick mouseover mouseout",
            function(event) {
                $(".div2").html("Event: " + event.type);
        #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;
    <!-- 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>

Before moving mouse anywhere-

After the mouse is moved over the big box-

After the mouse is moved outside of the big box-

This article is attributed to GeeksforGeeks.org

You Might Also Like

leave a comment



load comments

Subscribe to Our Newsletter