The problem with solutions that rely on popover('show') is that if you do this in the event handler for the show event, you will get an infinite loop.
If you just want to display some content in your popover when it has already been shown, you will need to directly modify the DOM:
$("#aIdPwd2").next(".popover").find(".popover-content").html(msg);
For example, if you want popover to load some data from the API and display this in popover content on hover:
DOM:
<a href="#" id="myPopover" data-toggle="popover" data-title="Details" data-api-parameter="someValue">Hover here for details</a>
JQuery
$("#myPopover").popover({ trigger: 'hover' }).on('shown.bs.popover', function () { var popover = $(this); var contentEl = popover.next(".popover").find(".popover-content"); // Show spinner while waiting for data to be fetched contentEl.html("<i class='fa fa-spinner fa-pulse fa-2x fa-fw'></i>"); var myParameter = popover.data('api-parameter'); $.getJSON("http://api.example.com", { 'apiParameter': myParameter }).done(function (data) { var result = data['apiReturnValue']; contentEl.html(result); }).fail(function (data) { result = "No info found."; contentEl.html(result); }); });
This, of course, assumes that you trust the data provided by api.example.com. If not, you probably want to avoid the data returned to reduce XSS attacks.
alexw source share