2

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.

Ritesh Chandora
  • 8,382
  • 5
  • 21
  • 38
  • I need more clarification. What is happening when you click the grey-button. Post the entire code relating to tooltip. It would be better if you could post a fiddle. – Foreever Mar 14 '14 at 05:37
  • Regarding toolTip. This is only code I have... And tooltip text is in TITLE attribute of buttons. Nothing else.. I am using bootstrap and Jquery UI both. this might be possible because of it. – Ritesh Chandora Mar 17 '14 at 05:58
  • This happens mainly when you are disabling something when you perform the click action. – Foreever Mar 17 '14 at 08:41

3 Answers3

4

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();
    });
});
Franky
  • 97
  • 8
0

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.
});
shpyo
  • 221
  • 1
  • 6
  • So you have to edit tooltip plugin. Removing tooltip element(s) should be done in plugin, everytime when a new one appears. – shpyo Mar 12 '14 at 06:58
0

Try this

$("#controlid").tooltip('hide');
Aamir
  • 16,329
  • 10
  • 59
  • 65
Safwan
  • 1
  • 6
    Welcome to Stack Overflow! While this code snippet may solve the question, including an [explanation](http://meta.stackexchange.com/questions/114762/explaining-entirely-code-based-answers) really helps to improve the quality of your post. Remember that you are answering the question for readers in the future, and those people might not know the reasons for your code suggestion. Please also try not to crowd your code with explanatory comments, this reduces the readability of both the code and the explanations! – yivi Mar 10 '17 at 11:13
  • Please provide an explanation. – Dropout Mar 10 '17 at 13:58