Sunil Chaudhary
Sunil Chaudhary

Reputation: 407

Bootstrap tooltip for dynamically created element coming on second time

I am dynamically adding an image to a span with below jQuery.

I want to show bootstrap tooltip on image's mouse enter, tooltip coming but from second time.

   $('span').append('<img src="Edited-Message.png" data-toggle="tooltip" data-placement="right" class="EditedChat" title="Removed />');

I am using following jQuery to add tooltip :-

$("body").on("mouseenter", "img.EditedChat", function () {
    $(this).tooltip();
});

TIA.

Upvotes: 0

Views: 191

Answers (1)

Manish Prajapati
Manish Prajapati

Reputation: 1641

Bind on the image to reposition the tooltip when it has finished loading :

$(img).load(function(){ $element.tooltipster('reposition') })

Upvotes: 1

Related Questions