Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery .click function doesn't work with middle button

I have the following code:

$(document).ready(function() {
                $("#TestLink").click(function() {
                    $("#LinkHolder").html("test");
    });
});

<span id="LinkHolder">
<a href="SomeLink" id="TestLink" target="_blank">Click here to test</a>
</span>

Everything works like a charm when I click with left mouse button on the link, but when I click it with CTRL+LeftMouseButton or MiddleMouseButton it doesn't work.

Will be glad if someone can help me with this one.

Thanks in advance!

like image 255
RRStoyanov Avatar asked Sep 24 '09 22:09

RRStoyanov


1 Answers

Consider:

$(document).ready(function() {
                $("#TestLink").mouseup(function(e) {
                    $("#LinkHolder").html("test");
    });
});

As an alternative? This does detect middle mouse button clicks.

like image 167
Waleed Amjad Avatar answered Sep 24 '22 13:09

Waleed Amjad