I've created a link with a qtip2 tooltip using the following code:
<a href="#" class="mylink">Show Tooltip</a>
$('.mylink').qtip({
show: {event: 'click'}
});
When the link is clicked, the tooltip opens as expected, but the browser also navigates to /#
, which causes the screen to scroll to the top. How can I prevent the original click event, without interfering with qtip?
Found the answer here. Just bind to the click event of the link and use preventDefault
.
$('.mylink').qtip({
show: {event: 'click'}
}).bind('click', function(event){ event.preventDefault(); return false; });