latest Post

Find which mouse button clicked using jQuery

Find which mouse button clicked using jQuery

$(document).ready(function() {

$('#btnClick').mousedown(function(event){

    switch (event.which) {

        case 1:

            alert('Left mouse button pressed');

            break;

        case 2:

            alert('Middle mouse button pressed');

            break;

        case 3:

            alert('Right mouse button pressed');

            break;

        default:

           break;

    }

});

});

About Mallikarjun A

Mallikarjun A
Recommended Posts × +

0 comments:

Post a Comment