Reputation:
In my simple form, js_submit_loading is assigned to <form>
and btn-loading is assigned to SEND <button>
Here is my js code:
$('.js_submit_loading').on('submit',function (){
$(this).find('#btn-loading').button('loading');
});
Now, how can i detect that button was clicked by left mouse button or scroll button i only know that which==2 stands for scroll click.
thanks in adv. for help
Upvotes: 1
Views: 101
Reputation: 1440
event.which will give 1, 2 or 3 for left, middle and right mouse buttons respectively.
$( "#whichkey" ).on( "submit", function( event ) {
$( "#log" ).html( event.type + ": " + event.which );
});
or
$('#submit').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:
alert('You have a strange Mouse!');
}
});
Upvotes: 1