Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/68.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 引导集popover内容_Javascript_Jquery_Html_Css_Twitter Bootstrap - Fatal编程技术网

Javascript 引导集popover内容

Javascript 引导集popover内容,javascript,jquery,html,css,twitter-bootstrap,Javascript,Jquery,Html,Css,Twitter Bootstrap,我一直试图找到一种使用Javascript动态修改bootstrap popover内容的方法,但迄今为止我遇到的方法都不起作用: <!--object with the popover--> <input id="popoverlist" type="text" name="poplist" placeholder="Enter data" data-html="true" data-content="" rel="popover" data-placement="bott

我一直试图找到一种使用Javascript动态修改bootstrap popover内容的方法,但迄今为止我遇到的方法都不起作用:

<!--object with the popover-->
<input id="popoverlist" type="text" name="poplist" placeholder="Enter data"  data-html="true" data-content="" rel="popover" data-placement="bottom" data-original-title="pop list" >

$('#popoverlist').popover({
                offset: 10,
                trigger: 'manual',
                animate: false,
                html: true,
                placement: 'left',
                template: '<div class="popover" onmouseover="$(this).mouseleave(function() {$(this).hide(); });"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'

            }).click(function(e) {
                e.preventDefault() ;
            }).mouseenter(function(e) {
                $(this).popover('show');
            });

$(“#popover列表”).popover({
抵销:10,
触发器:“手动”,
动画:假,
是的,
位置:'左',
模板:'

' })。单击(功能(e){ e、 预防默认值(); }).mouseenter(函数(e){ $(this.popover('show'); });
我一直尝试使用的设置html内容的方法有:

$('#popoverlist').data('bs.popover').html("<p>New content</p>");
//and using the inner HTML
document.getElementsByClassName("popover-content")[0].innerHTML = '<p>New content</p>';
$('popooverlist').data('bs.popover').html(“新内容”

”); //以及使用内部HTML document.getElementsByCassName(“popover内容”)[0]。innerHTML='新内容


但是,这两种方法都不会更改html数据内容。如果您能帮我找到正确的方向,我将不胜感激:)

您的第二个想法可行,但您需要在创建popover内容后调用它

popover直到第一次显示时才创建,每次调用
show
后都会重新创建。因此,您需要更改
$(this.popover('show')之后的内容

我已经包含了一个片段,展示了这一点:

$('popooverlist').popover({
抵销:10,
触发器:“手动”,
动画:假,
是的,
位置:'底部',
模板:'

' })。单击(功能(e){ e、 预防默认值(); }).mouseenter(函数(e){ $(this.popover('show'); //在放映后动态更改内容 document.getElementsByCassName(“popover内容”)[0]。innerHTML='新内容

; });
您的第二个想法可行,但您需要在创建popover内容后调用它

popover直到第一次显示时才创建,每次调用
show
后都会重新创建。因此,您需要更改
$(this.popover('show')之后的内容

我已经包含了一个片段,展示了这一点:

$('popooverlist').popover({
抵销:10,
触发器:“手动”,
动画:假,
是的,
位置:'底部',
模板:'

' })。单击(功能(e){ e、 预防默认值(); }).mouseenter(函数(e){ $(this.popover('show'); //在放映后动态更改内容 document.getElementsByCassName(“popover内容”)[0]。innerHTML='新内容

; });


你是对的,一旦我换了位置,内容就变了,谢谢:)你是对的,一旦我换了位置,内容就变了,谢谢:)