Twitter Bootstrap Popovers not working for Dynamically Generated Content

二次信任 提交于 2019-11-27 13:59:15

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'});
  });

In the success function of the ajax you need to call the popover. Something like this

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

This Function will work properly in the selector you have to specify the location on the page where you have to search "rel=popover" like I put *

$(function ()  
{
console.info($("*[rel=popover]"));
$("*[rel=popover]").popover();
});
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!