How do you obtain the clicked mouse button using jQuery?
$(\'div\').bind(\'click\', function(){
alert(\'clicked\');
});
this is trigger
To those who are wondering if they should or not use event.which
in vanilla JS or Angular : It's now deprecated so prefer using event.buttons
instead.
Note : With this method and (mousedown) event:
and (mouseup) event will NOT return the same numbers but 0 instead.
Source : https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons