views:

18

answers:

0

I use this tooltip plugin to make the tooltip on element as

$('.showtooltip').tooltip({
            delay: 0,
            track: true,
            showURL: false,
            bodyHandler: function() {
                var tipStr = "SOME DISPLAY HTML";
                return $(tipStr);
            }
        });

And my ajax create element dynamically.

$("<img alt='' class='showtooltip' src='image.jpg' />");

so when this image is added to document. The tooltip doesn't display. Then I use live() in jquery :

$(".showtooltip").live("mouseover", function() {
                $(this).tooltip({
                    delay: 0,
                    track: true,
                    showURL: false,
                    bodyHandler: function() {
                        var tipStr = "SOME DISPLAY HTML";
                        return $(tipStr);
                    }
                })
            });

But tooltip only display after the first time mouse over the image. How can i use tooltip on dynamic element ?