0

I'm using AJAX to inject elements into the DOM:

$.ajax({
    url: 'foo.html',
    type: 'post',
    data: { foo: "bar"},
    success: function (html) {

        $("#foo").html(html);
        $('[data-toggle="tooltip"]').tooltip();
    }
});

The tooltip does not seem to apply for DOM elements surrounded by button in Firefox (tested on V19.0)

Js fiddle : http://jsfiddle.net/cyberjar09/4nUMu/1/

I noticed when I remove the icon element outside the button element, firefox is working again.

I am able to query the elements from the Firebug console (they exist in the DOM)

$('[data-toggle="tooltip"]')

What's wrong?

I usually see a <div class="tooltip" ...> element appear in the DOM as a sibling for the element on which I want to execute tooltip but this does no happen for the Dynamic elements Im testing with in Firefox

IE 9 and Chrome 25 seem to work just fine

cyberjar09
  • 770
  • 1
  • 7
  • 18
  • Can you do a `console.log($('[data-toggle="tooltip"]'))` before the call to tooltip to see how many elements are appearing at that moment – Arun P Johny Mar 01 '13 at 02:50
  • As already mentioned in the question, _I am able to query the elements from the Firebug console_ In Other words, I am able to see the elements in the console log and am able to highlight them from the result of the console log – cyberjar09 Mar 01 '13 at 07:28
  • that is after the said code is executed right, what I asked is to see if there is a delay in updating the dom tree from firefox side. That is why I asked to add the `console.log()` between the lines `$("#foo").html(html);` and `$('[data-toggle="tooltip"]').tooltip();` – Arun P Johny Mar 01 '13 at 07:33
  • @ArunPJohny : Yes I am able to see the elements in the console.log(); – cyberjar09 Mar 01 '13 at 07:35
  • I even did a setTimeout(..., 800) but it does not seem to be a race condition issue – cyberjar09 Mar 01 '13 at 07:43
  • if you do `$('[data-toggle="tooltip"]').tooltip();` from console whether it is working – Arun P Johny Mar 01 '13 at 08:07
  • This question may help: http://stackoverflow.com/questions/9958825/how-do-i-bind-twitter-bootstrap-tooltips-to-dynamically-created-elements – mccannf Mar 01 '13 at 09:14
  • @mccannf thanks for the input, I tried this as well, still not working. – cyberjar09 Mar 04 '13 at 01:42
  • updated problem description, found cause of the issue. – cyberjar09 Mar 04 '13 at 03:02
  • raised issue against this in github : https://github.com/twitter/bootstrap/issues/7129 – cyberjar09 Mar 04 '13 at 03:19

1 Answers1

0

It was recognised as a legitimate issue on GitHub by Bootstrap team. It has been closed now: https://github.com/twitter/bootstrap/issues/7129

cyberjar09
  • 770
  • 1
  • 7
  • 18