Bootstrap popover content cannot changed dynamically

后端 未结 14 2255
旧时难觅i
旧时难觅i 2020-11-29 22:40

I use the code as follows:

$(\".reply\").popover({
  content: \"Loading...\",
  placement: \"bottom\"
});

$(\".reply\").popover(\"toggle\");
14条回答
  •  自闭症患者
    2020-11-29 23:34

    When a popover is enabled, it retains its previous version(if it was created already) even if the data is change. You need to destroy the previous version to allow for the new popover to be created again. In Bootstrap 4.x do it by

    .popover('dispose')
    

    do it whenever there is a change in data through an ajax call.

提交回复
热议问题