How to insert close button in popover for Bootstrap
jquery, popover, twitter-bootstrap
Solution
You need to make the markup right
<button type="button" id="example" class="btn btn-primary">example</button>
Then, one way is to attach the close-handler inside the element itself, the following works :
$(document).ready(function() {
$("#example").popover({
placement: 'bottom',
html: 'true',
title : '<span class="text-info"><strong>title</strong></span>'+
'<button type="button" id="close" class="close" onclick="$("#example").popover("hide");">×</button>',
content : 'test'
});
});
Problem
JS: ``` $(function(){ $("#example").popover({ placement: 'bottom', html: 'true', title : '<span class="text-info"><strong>title</strong></span> <button type="button" id="close" class="close">×</button>', content : 'test' }) $('html').click(function() { $('#close').popover('hide'); }); }); ``` HTML: ``` <button type="button" id="example" class="btn btn-primary" ></button> ``` i'm write your code isn't show your popup. anyone come across this problem?