JQuery click () event; how to prevent this event on the right mouse button?
1 answer
You can evaluate the attribute event.which
to determine which button was clicked.
$("#test_img").mouseup(function(e) {
// e.which is 1, 2 or 3 for left / middle / right mouse button
if (e.which === 1) {
//continue
}
});
Also, to safely detect the mouse button, you cannot use click
-event! Use mousedown
or instead mouseup
.
+4
a source to share