Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Dynamic update tooltip content doesnot work for me

edited September 2015 in Tipped
My code structure is:

I set tooltip using javascript onload after click on it I want to change tooltip for that I write
var tooltip_id='info_1_2';
Tipped.remove();
Tipped.remove('#' + tooltip_id);
Tipped.remove(this);
Tipped.create('#'+tooltip_id, $('

').html('1234'));
But it shows both previous and updated tooltip..Please correct me if I am wrong anywhere..This tooltip helped me alot..

Comments

  • edited September 2015
    Tipped.create creates a new tooltip, it doesn't remove a previous one. That way you can have multiple tooltips on the same element.

    If you want to remove the previous one, use Tipped.remove before Tipped.create on the same element:
    Tipped.remove('#' + tooltip_id);
    Tipped.create('#' + tooltip_id, '1234');
    Also make sure you don't have multiple elements on the page with the same id, an id needs to be unique to be valid. Tipped.remove in the code above will only point to the first element with that id.
  • edited September 2015
    yah I tried that too but it keeps both tooltip..and dont I need to do like Tipped.create('#'+tooltip_id, $('').html('1234'));???
  • edited September 2015
    No, "1234" is a string that you can push into the tooltip, not sure what you are trying to do by wrapping it with jQuery, it'll just work without it.

    Having 3 calls to Tipped.remove also isn't needed, the one without parameters is even incorrect, perhaps the one with 'this' as well, can't say what that points to. I don't see your page so I can't see what else might be causing a problem. Make sure you are using the latest version of Tipped.

    Here's an example that works on tippedjs.com when run in the console:
    Tipped.create('#logo', 'this will be removed');
    Tipped.remove('#logo');
    Tipped.create('#logo', 'test', { skin: 'light' });
    Tipped.show('#logo');
  • ahan I will try and thnx for reply :)
Sign In or Register to comment.