gpt4 book ai didi

javascript - 关闭 Bootstrap 弹出窗口不起作用

转载 作者:行者123 更新时间:2023-12-02 18:41:48 25 4
gpt4 key购买 nike

我有以下js代码

$('#myelemt').popover({placement: 'right', title: 'What is this',
content: 'content content content content content content content content content content content ', trigger: 'manual', html: 'true', container: '.wrap'});

$('#myelemt').click(function(e) {
$('#myelemt').popover('show');
$('.popover-title').append('<button type="button" class="close close_help">&times;</button>');
e.stopPropagation();
});

$('.close_help').click(function(e) {

$(this).parents('#myelemt').popover('hide');
e.preventDefault();
});

我想在单击 .close_help 时关闭弹出窗口,但它不起作用。我尝试了多种方法来访问父 .popover隐藏它,但它不起作用。以上是其中一种方法

这是一个jsfiddle模拟

最佳答案

请查看jsfiddle

我仅在以下行中进行了更改

$('.popover-title').append('<button type="button" class="close close_help" onclick="$(&quot;#myelemt&quot;).popover(&quot;hide&quot;);">&times;</button>');

让我知道您的意见。

关于javascript - 关闭 Bootstrap 弹出窗口不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16772293/

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