Responding to various mouse clicks with jQuery
Mouse has been the primary medium of input for decades. Normally there are three types of mouse click. They are left, right and middle click.
In jQuery, we all knew there is a click() method acts as event handler to capture this action.
But how to capture a specific click. For example, if we want to make some change only on left click or only on right click.
Of course, the common click() handler will not help us in this case. So we need to move for targeting specfic click event.
But how to capture this specific click action. Is it possible? Yes it is with below code snippet,
With mousedown() method we can capture the specific clicks.
This works on majority of browsers like Chrome, Firefox, IE and Safari. By capturing the code value returned by e.which we can determine the specific click. Hope this blog may help you.