Chris Chris - 1 year ago 61
jQuery Question

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?


Answer Source

Hiya please see working demo here:

I have made the changes to get your desired outcome. :)

I reckon you already know what you are doing but some example recommendations from my end as follows for sample: - sharing this link to give you idea for different link with different pop-over if you will see the source notice attribute data-content but what you wanted is working by the following changes.

Have a nice one and hope this helps. D'uh don't forget to up vote and accept the answer :)

Jquery Code

var i = 0;
$('a#test').click(function() {
    i += 1;

        trigger: 'manual',
        placement: 'right',
        content: function() {
           var message = "Count is" + i;
             return message;



<a id="test">Click me</a>