Reputation: 539
Let's suppose that I have the following dropdown after the last div, a dropdown menu appears once he clicks.
<div id="test"> <a href="clickthrough.php">Arrow</a> </div>
I want the user to be able to click on this element and the dropdown appear but also if he mid clicks to be able to open this link directly in a new tab. In other words I want to prevent the default action onclick but still show the link of the element on hover or whatever.
Thank you
Upvotes: 0
Views: 310
Reputation: 10437
with jquery 1.7+
$('#test a').on('click', function (e) {
if (e.which < 2) { // left mouse button
e.preventDefault();
// and code to show dropdown
}
});
Upvotes: -1
Reputation: 822
you can do
<div id="test"> <a href="clickthrough.php" onclick="FunctionForOpeningLink();return false;">Arrow</a> </div>
Upvotes: 3