Bootstrap popover content cannot changed dynamically

后端 未结 14 2283
旧时难觅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:31

    you can just pass the title as function

    var content = 'Loading...'
    
    function dynamicContent(){
      return content
    }
    $(".reply").popover({
      content: dynamicContent,
      placement: "bottom"
    });
    
    $(".reply").popover("toggle");
    

    and then change the variable content dynamically.

提交回复
热议问题