[英]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">×</button>');
e.stopPropagation();
});
$('.close_help').click(function(e) {
$(this).parents('#myelemt').popover('hide');
e.preventDefault();
});
我想在關閉時關閉popover。 單擊close_help
,但它不起作用。 我嘗試了幾種方法來獲取父.popover
來hide
它但它不起作用。 以上是其中一種方式
這是一個jsfiddle模擬
請看看jsfiddle
我只對以下行進行了更改
$('.popover-title').append('<button type="button" class="close close_help" onclick="$("#myelemt").popover("hide");">×</button>');
讓我知道你的意見。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.