Ritesh Chandora
Ritesh Chandora

Reputation: 8640

JQuery tooltip is not disappearing after button click and show with other hover items

As you can see in image first gray button is clicked and than I put mouse on last button it hovers the Tooltip. Both are showing at the same time.

Once the button is clicked tooltip will not disappeared until you on click something else.

enter image description here

I have lots of tooltip in document so I am using this.

$( document ).tooltip()

I tried this for removing tooltip but doesn't work.

$( document ).tooltip().click(function() {
    $(document).tooltip( "close");
});

Also I tried to put some hidingToolTip function on onClick event of each element and it works fine. but I need a generalize solution.

Upvotes: 2

Views: 2565

Answers (3)

Safwan
Safwan

Reputation: 1

Try this

$("#controlid").tooltip('hide');

Upvotes: 0

Franky
Franky

Reputation: 97

If you initialize the tooltip using:

$('[data-toggle="tooltip"]').tooltip();

Then you can use the following code to make them fade out after a click:

$('[data-toggle="tooltip"]').click(function() {
    $('.tooltip').fadeOut('fast', function() {
        $('.tooltip').remove();
    });
});

Upvotes: 4

shpyo
shpyo

Reputation: 221

You have to remove tooltip DOM element(s) everytime when you fire a new tooptip e.g.

$(element).click(function() {
    $('.tooltip_element').remove();
    // show new tooltip.
});

Upvotes: 0

Related Questions