当前位置:首页>正文

Bootstrap里怎么动态创建一个popover bootstrap怎样做动态的文字

2023-04-23 18:19:18 互联网 未知

Bootstrap里怎么动态创建一个popover

Bootstrap里如何动态创建一个popover

一种简单的方法就是自己写 popover 的 html,并且在需要显示 popover 的地方控制内容变化。
$("#your-button").popover({
html: true,
content:

...

})
.click(function() {
$("#content").text(YOUR CONTENT)
})

P.S. 最新的 bootstrap 3 的 popover(options) 初始化参数里提供了修改默认 popover template html 的选项,我没有实际用过不确定有没有坑,看起来会比上面的方法更加优雅。

js: