I’ve got a little (and i mean mini) tooltip plugin that i’ve created but have run into an issue. Basically, it all works fine if instantiated on the dom ready event. However, if I need (as i do) to bring $ajax data onto the page that changes the dom, then my pluggin no longer (for obvious reasons) works.
I don’t quite know where in the plugin i’d add the neccessary code to allow it to function correctly (i’ve tried attaching the live event onto the hover and mousemove events but with eratic results). I DON’T want to have to to reinitialize the tooltip code everytime the $ajax method is run, as there are quite a few different ones involved in the page. I’d rather some sort of ‘live’ functionality was able to be attached to the tooltip plugin.
Anyway, the full trace can be found here:
http://www.jsfiddle.net/jimibt/FLSXv/
hope it twigs/rings a bell somewhere…
[update] to re-iterate, adding the live event onto the hover and mousemove events causes eratic results in my ‘real’ example. i’m looking for an alternative to this. thanks…
When you apply your tooltip, also add a new class such as
hasTooltip. Then, when you complete your AJAX request look for allaelements that do not have thehasTooltipclass, but do have thevtipclass, applied and run your$.tooltip()function on them.You can find these new elements like so:
See my update to your example.