Twitter Bootstrap Popovers not working for Dynamically Generated Content

后端 未结 3 534
伪装坚强ぢ
伪装坚强ぢ 2020-12-03 07:45

New to posting on stackoverflow here, so my apologies in advance if I messed anything up here.

I\'m using Twitter Bootstrap\'s popovers. My popovers seem to be worki

3条回答
  •  执笔经年
    2020-12-03 08:18

    You need to call $("[rel=popover]").popover({placement:'left'}); AFTER the elements are in the DOM.

    UPDATE

    If you are using jQuery

    $(element_selector)
      // load results into HTML of element_selector
      .load('your/php/file')
      // when done, initialize popovers
      .done(function(){
        $("[rel=popover]").popover({placement:'left'});
      });
    

    OR a catch all for jQuery ajax requests

    $.ajaxComplete(function(){
        $("[rel=popover]").popover({placement:'left'});
      });
    

提交回复
热议问题