There's an action I'd like to fire when a user middle-clicks on an element.
.click only captures left click (right? or at least that's the case in my experiments on firefox).
I know I can simply make a mousedown/mouseup event and detect which button was clicked, but I'm not sure if I'll be missing out various compatibility/safety/etc. features that .click has.
What .middleclick function can I write to get as close as possible to the same behavior as .click?
below are my experiments
// this does NOT work for middle-click or right-click
$("a").click(function(e) {
  e.preventDefault();
  alert(e.which);
});
// this DOES work for all three types of click (although fwiw for right-click
// it does not prevent contextual menu from coming up in FF
document.addEventListener("click", function(e){
    e.preventDefault();
    alert(e.which);
}, true);