【发布时间】:2017-11-11 09:57:16
【问题描述】:
我正在尝试将引导弹出窗口添加到包含任意内容的 div 元素中(但我想出的方法不起作用):
<div id="popover-target">
<h3>I need a popover</h3>
<p>
This is some content for the section
that needs to be explained by the popover.
</p>
</div>
<button class="btn">Show popover</button>
<script>
$(function(){
$('.btn').click(function(){
$('#popover-target').popover({title: 'Title', content: 'Test Content', container: 'body', placement: 'right'});
});
});
</script>
如果我将$('#popover-target') 更改为$('.btn'),则弹出框会正确显示。有什么想法吗?
【问题讨论】:
-
第二个
$$('$popover-target')中的一个错字 -
@guradio 是的,这是一个错字,抱歉已修复。
标签: javascript jquery html twitter-bootstrap popover