2013-05-27 62 views
0

,我有以下的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被點擊,但它不起作用。我嘗試了幾種方法,讓父母.popoverhide它,但它不起作用。以上是這些途徑之一

這裏是一個jsfiddle模擬

+0

可能的重複http://stackoverflow.com/questions/13413057/how-to-insert-close-button-in-popover-for-bootstrap/13413660#13413660 – davidkonrad

回答

2

請看看jsfiddle

我在下面的行更改僅

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

讓我知道您的意見。