How to update bootstrap popover text?

后端 未结 9 886
长发绾君心
长发绾君心 2020-12-07 20:31

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

9条回答
  •  广开言路
    2020-12-07 20:58

    Hiya please see working demo here: http://jsfiddle.net/4g3Py/1/

    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: http://dl.dropbox.com/u/74874/test_scripts/popover/index.html# - 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;
    
        $('a#test').popover({
            trigger: 'manual',
            placement: 'right',
            content: function() {
               var message = "Count is" + i;
                 return message;
            }
        });
        $('a#test').popover("show");
    
    });​
    

    HTML

    Click me

提交回复
热议问题