我创建了一个div
,用于动态创建Bootstrap 4弹出式窗口的data-content
div html是
> <div id="popover-content-wrapper" style="display: none">
> <div><a href="#" id="popover-dismiss">Dismiss</a></div>
> <div>This is your div content with a checkbox</div>
> <div>
> <input id="box1" type="checkbox" />
> <label for="box1">Checkbox 1</label>
> </div> </div>
使用以下javascript
显示弹出框时,HTML中未包含该复选框
const popoverHtml = $("div#popover-content-wrapper").html();
$('#chart-controls').popover({
html: true,
container: '#chart-controls',
placement: 'top',
delay: 0,
animation: false,
content:
function() { return popoverHtml }
}).popover('show')
选择器html()调用肯定会返回包含输入/标签的div,但显示的弹出式HTML是
<div class="popover-body"><div><a href="#" id="popover-dismiss">Dismiss</a></div>
<div>This is your div content with a checkbox</div>
<div>
</div>
</div>
Bootstrap中是否有不喜欢输入HTML的内容?