ajaxtwitter-bootstraptooltip

Bootstrap tooltip on AJAX content


I have a problem regarding the bootstrap tooltip on ajax loaded content.

I know there are other answers but it doesn't seem to work for me and i tried alot of methods.

First i am initializing the bootstrap tooltip using this code:

$(document).on('ready', this, function(e){
    $("[rel='tooltip']").tooltip();
});

Which works great on normal content but not on ajax.

Secondly i have found here that i need to add a selector so i added a class to the ajax loaded content in this form:

<button data-toggle="modal" rel='tooltip' data-placement="top" data-original-title="View Supplier Details" data-target="#view-supplier" type="button" class="btn btn-success view-supplier btn-xs margin-left-5 tooltip-aj">

And modified the call of the tooltip to the following:

$(document).on('ready', this, function(e){
    $("[rel='tooltip']").tooltip({
         selector:'tooltip-aj'
    });
});

But still can't get it to work. Can somebody please help me.

Regards!


Solution

  • Ok i found an answer just after i posted the question:

    Here it is, as it is a bit frustrating sometime:

    $('body').tooltip({
        selector: '[rel=tooltip]'
    });