如何更新bootstrap popover文本? [英] How to update bootstrap popover text?

查看:171
本文介绍了如何更新bootstrap popover文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用bootstrap-popover在元素旁边显示一条消息。



如果我想在第一次之后在popover中显示不同的文本,那么文本会没变。使用新文本重新实例化弹出窗口不会覆盖。



查看这个js小提琴的实例:



http://jsfiddle.net/RFzvp/1/



(警报中的消息)在第一次点击后,dom中的消息不一致)
文档对如何解除绑定有点说明: http://twitter.github.com/bootstrap/javascript.html#popovers



我用错了吗?关于如何解决的任何建议?



谢谢

解决方案

Hiya请在这里看到演示 http://jsfiddle.net/4g3Py/1/ / p>

我已做出更改以获得您想要的结果。 :)



我认为你已经知道你在做什么,但是我的结论中的一些示例建议如下: http://dl.dropbox.com/u/74874/test_scripts/popover/index.html# - 分享此链接给你如果您将看到源通知属性 data-content ,则可以使用不同的弹出式链接,但您想要的是通过以下更改进行操作。



有一个好的,希望这会有所帮助。呃,不要忘记投票并接受答案:)



Jquery代码

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

$('a #test')。popover({
触发器:'手动',
放置:'右',
内容:function(){
var message =Count is+ i;
返回消息;
}
});
$('a #test')。popover(show);

});

HTML

 < a id =test>点击我< / a> 


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:

http://jsfiddle.net/RFzvp/1/

(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: http://twitter.github.com/bootstrap/javascript.html#popovers

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

Thanks

解决方案

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

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

这篇关于如何更新bootstrap popover文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆