janmvtrinidad janmvtrinidad - 6 months ago 37
jQuery Question

Boostrap popover not sticking inside modal

The problem is when I use popover outside the modal, it functions as expected, when you scroll down, popover it sticking to its element that triggers the popover.

But when I use it inside the modal, the problem start from there, it is not sticking to element thats trigger the popover.
I'm initializing popover with this code.
Please refer to this demo.

$('#popover1').popover({
container: "body",
html: true,
content: function () {
return '<div class="popover-message">' + $(this).data("message") + '</div>';
}
});

Answer

Set the container config to your modal.

i.e. container: $('#myModal').

https://jsfiddle.net/daveSalomon/gxn8o2hm/7/