1

http://jsfiddle.net/X47f5/1/

html:

<a href="javascript:void(0);">test link</a>​

javascript:

$('a').bind('click mouseup mousedown',function(e){
    e.preventDefault();
    return false;
});​

Is there any fix to prevent this behavior?

In all other browsers it's working as intended.

2
  • prevent what behavior? the middle click? or the "click mouseup mousedown"? Also, my Chrome opens a new tab on middle click on your demo.
    – Joseph
    Dec 28, 2012 at 14:35
  • When using jQuery events you only need put return false, as this behind the scenes also fires preventDefault and stopPropagation
    – rlemon
    Dec 28, 2012 at 14:58

1 Answer 1

1

According to Javascript Madness: Mouse Events:

The middle mouse button in Opera is broken too. It triggers an events, but the default action cannot be disabled. No fiddling with the manner of its brokeness has occured so far.

So it seems you are out of luck until Opera gets fixed.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.