JS:
$(function(){
$(\"#example\").popover({
placement: \'bottom\',
html: \'true\',
title : \'
$('.tree span').each(function () {
var $popOverThis = $(this);
$popOverThis.popover({
trigger: 'click',
container: 'body',
placement: 'right',
title: $popOverThis.html() + '',
html: true,
content: $popOverThis.parent().children("div.chmurka").eq(0).html()
}).on('shown.bs.popover', function (e) {
var $element = $(this);
$("#close").click(function () {
$element.trigger("click");
});
});
});
When you click element and show your popup, next you can raise event shown.bs.popover where in this you get element in which trigger click to close your popover.