gpt4 book ai didi

jquery - 如何在 Bootstrap 的弹出窗口中插入关闭按钮

转载 作者:IT王子 更新时间:2023-10-29 03:26:03 26 4
gpt4 key购买 nike

JS:

$(function(){
$("#example").popover({
placement: 'bottom',
html: 'true',
title : '<span class="text-info"><strong>title</strong></span> <button type="button" id="close" class="close">&times;</button>',
content : 'test'
})
$('html').click(function() {
$('#close').popover('hide');
});
});

HTML:

<button type="button" id="example" class="btn btn-primary" ></button>

我写的是你的代码,没有显示你的弹出窗口。

有人遇到过这个问题吗?

最佳答案

你需要做正确的标记

<button type="button" id="example" class="btn btn-primary">example</button>

然后,一种方法是在元素本身内附加关闭处理程序,以下工作:

$(document).ready(function() {
$("#example").popover({
placement: 'bottom',
html: 'true',
title : '<span class="text-info"><strong>title</strong></span>'+
'<button type="button" id="close" class="close" onclick="$(&quot;#example&quot;).popover(&quot;hide&quot;);">&times;</button>',
content : 'test'
});
});

关于jquery - 如何在 Bootstrap 的弹出窗口中插入关闭按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13413057/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com