Hik200
Hik200

Reputation: 149

Bootstrap to hide popover need press button twice

I'm using Bootstrap v3.3.7

I need to click twice to hide a popover.

I have problem like this https://jsfiddle.net/hik200/ejxkv8hb/1/

$('body').on('hidden.bs.popover', function (e) {
$(e.target).data("bs.popover").inState.click = false; });

Upvotes: 0

Views: 108

Answers (1)

Nicolas
Nicolas

Reputation: 8670

I edited your fiddle, you were adding the click listener once on your button click, which did not actually trigger the close function :

    function ClosePopover() {
$("#destroy").click(function(){
    $("[data-toggle='popover']").popover('hide');


});
console.log('asd');
}

this is good :

function ClosePopover() {
    $("[data-toggle='popover']").popover('hide');
    console.log('asd')
}

Upvotes: 3

Related Questions