jQWidgets Forums

jQuery UI Widgets Forums Dialogs and Notifications Tooltip, Notification, Popover Dynamic tooltips – how to clean and destroy

This topic contains 1 reply, has 1 voice, and was last updated by  andy8 11 years, 6 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author

  • andy8
    Participant

    Hello all,

    This is the scenario of dynamically generated tooltips.

    1. I have several divs generated dynamically on the same page with identical tooltips.

    2. I generate a div with class “abc” and add a tooltip after – $(“div.abc”).jqxTooltip({ content: …

    3. Then I generate another div with the same class (there are two divs on the same page now) and add another tooltip for all divs with the same class, i.e. $(“div.abc”).jqxTooltip({ content: …

    4. Everything works fine, but it accumulates garbage tooltip divs at the bottom of the page, because every time it adds two new tooltips, but doesn’t destroy or override previous invisible tooltip divs.

    I tried adding a line $(“div.abc”).jqxTooltip(‘destroy’); before adding new tooltips for the same div class, but it doesn’t do anything.

    How can I clean these previously generated toolotips?

    Thanks


    andy8
    Participant

    I have figured it out. If a tooltip element (the one to which a tooltip is attached) is destroyed before attampting to destroy its tooltip, an orphan tooltip div remains on the page.

    If I destroy a tooltip first (i.e. $(“div.abc”).jqxTooltip(‘destroy’)) and its element second, everything works fine.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.