Javascript – How to update bootstrap popover text


I am using bootstrap-popover to show a message beside an element.

If I want to show different text in the popover after the first time, the text does not change. Re instantiating the popover with new text does not overwrite.

See this js fiddle for a live example:

(The message in the alert and the message in the dom is inconsistent after the first click)
The documentation is a bit light on how to unbind:

Am I using this wrong? The Any suggestions on how to work around?


Best Solution

You can access the options directly using the jquery data closure dictionary like this:

$('a#test').data('bs.popover').options.content = 'new content';

This code should work fine even after first initializing the popover.