web-profile

Bootstrap 4 hide popover on click outside

$('body').on('click', function (e) {
    if ($(e.target).data('toggle') !== 'popover'
        && $(e.target).parents('[data-toggle="popover"]').length === 0
        && $(e.target).parents('.popover.show').length === 0) {
        $('[data-toggle="popover"]').popover('hide');
    }
});

Leave a Reply

Your email address will not be published.