используя bootstrap popover, и теперь я пытаюсь заставить этот код нажать вне popover, чтобы закрыть popover:
$('body').on('click', function (e) {
$('[data-toggle="popover"]').each(function () {
//the 'is' for buttons that trigger popups
//the 'has' for icons within a button that triggers a popup
if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) {
$(this).popover('hide');
}
});
});
Но когда я использую эту часть, я могу закрыть popover, но я не могу нажать на другие кнопки, кто-нибудь понял, как я могу это сделать?
Все кнопки:
<a href="#" class="btn btn-xs btn-primary" data-toggle="popover">This opens popover</a>
<a href="#" class="btn btn-xs btn-primary">Other link</a> <- Doesn't work
<a href="#" class="btn btn-xs btn-primary">Other link</a> <- Doesn't work