Search code examples
javascriptjqueryjquery-uitooltip

jQuery UI Tooltip and AJAX, how to implement live() with it?


On certain pages I have code like $('.tooltip').tooltip();. Example element would look like:

<a title="Tooltip content" class="tooltip" href="javascript:void(0);"><img src="icon.png" /></a>

This works beautifully unless I want to reload those elements with AJAX. Then, the tooltip handlers are not reattached to the new content and the tooltips do not work any more.

I have attempted to do a workarounds to somehow reattach the tooltip to the elements with no particular success. Any advice is appreciated!


Solution

  • You need to reinitialise tool-tip $('.tooltip').tooltip(); in your AJAX success callback