【问题标题】:closing bootstrap popover doesn't work关闭引导弹出窗口不起作用
【发布时间】:2013-05-22 06:11:42
【问题描述】:

我有以下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 联系到hide 的方法,但它不起作用。以上是其中一种方式

这是一个jsfiddle 模拟

【问题讨论】:

标签: javascript jquery twitter-bootstrap popover


【解决方案1】:

请看jsfiddle

我只在下面一行做了更改

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

让我知道你的 cmets。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-12-21
    • 2013-03-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-05
    相关资源
    最近更新 更多