I need to show bootstrap tooltip when user click on element and condition is false. I've written code for this:
<div data-toggle="tooltip" title="You must to log in!" class="stars">425</div>
and Javascript:
$(".statistics .stars").click( function(){
if (! user.isLogin){
$(this).tooltip("show");
setTimeout(function(){
$(this).tooltip( 'hide' );
}, 2000);
}
});
When I don't click I can see default tooltip on hover (I don't need it) and when I click, tooltip don't hide after 2 seconds. How to solve this problems?