簡體   English   中英

關閉引導程序彈出窗口不起作用

[英]closing bootstrap popover doesn't work

我有以下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();
});

我想在關閉時關閉popover。 單擊close_help ,但它不起作用。 我嘗試了幾種方法來獲取父.popoverhide它但它不起作用。 以上是其中一種方式

這是一個jsfiddle模擬

請看看jsfiddle

我只對以下行進行了更改

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

讓我知道你的意見。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM