I want to use select2 in a bootstrap popover for multiple selection. Selection works fine.
But when I click on x to remove some element, the popover closes itself and only the selection stays.
How can I solve this problem?
I want to use select2 in a bootstrap popover for multiple selection. Selection works fine.
But when I click on x to remove some element, the popover closes itself and only the selection stays.
How can I solve this problem?
you can prevent popover dismiss when click
$(document).on('click', function (e) {
$('[data-toggle="popover"],[data-original-title]').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').data('bs.popover')||{}).inState||{}).click = false // fix for BS 3.3.6
}
});
});
you can see more here: https://stackoverflow.com/a/14857326/3344953