0

I use tooltipster plugin for my tooltip

$(function(){
     $('.tooltip').tooltip();
});

Now the .tooltip that were added later dynamically does not respond to tooltip()

Now many will say to call $('.tooltip').tooltip(); each time i add those elments. But since i have hundreds of thousands of elements that contain .tooltip and are created from hundrends of functions I cannot call the $('.tooltip').tooltip(); hundred times . Is there any alternative ?

user3675747
  • 127
  • 1
  • 1
  • 6
  • See the discussion [over here][1]. [1]: http://stackoverflow.com/questions/25119796/tooltipster-does-not-work-in-a-generated-content/25122249#25122249 – Stuart Hallows Dec 23 '14 at 06:58

1 Answers1

0

In such cases, delegate listeners are a good option. You listen for mouseenter events (for example) on a common ancestor and create and show the tooltip on the hovered child accordingly. Tooltipster has API methods that allow this.

Louis Ameline
  • 2,779
  • 1
  • 25
  • 25