bootstrap popover: reload content with ajax

后端 未结 5 1430
予麋鹿
予麋鹿 2021-02-01 10:52

I\'m having trouble reloading content of a bootstrap popover with ajax. Here\'s some code: http://pastie.org/3960102

The second ajax request (when I click on \"a.close\"

5条回答
  •  我在风中等你
    2021-02-01 11:15

    Why empty() and then append() when you can just replace?

    t.data('popover').tip().find('.popover-content').html(r);
    

    EDIT:

    Also, the first approach is correct and works fine (bootstrap 2.1) when popover is already initialized and you want to change the contents on the fly. You just have to call 'show' again for the popover to refresh (content and position):

    t.attr('data-content', r);
    t.popover('show');
    

提交回复
热议问题