javascript - Bootstrap 弹出窗口未关闭

标签 javascript twitter-bootstrap popover

我正在使用 Bootstrap 弹出窗口,当单击某个特定按钮时,它会打开并再次单击相同的按钮关闭。

我试图在标题旁边添加一个关闭按钮并且成功了,但是当我点击关闭按钮时没有关闭。

我的代码:

$('#emailPopover').popover({
        placement:'right',
        trigger: 'click',
        html: true,
        title:'Voter Variables'+
             '<button type="button" id="close" class="close" onclick="$(this).popover("hide");">&times;</button>'
    }); 

最佳答案

尝试使用 " 而不是这样的引号:

$('#emailPopover').popover({
        placement:'right',
        trigger: 'click',
        html: true,
        title:'Voter Variables'+
             '<button type="button" id="close" class="close" onclick="$(&quot;#emailPopover&quot;).popover(&quot;hide&quot;);">&times;</button>'
    }); 

bootply 示例:http://www.bootply.com/pd2qZayqju

关于javascript - Bootstrap 弹出窗口未关闭,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27503807/

相关文章:

javascript - 为什么闭包无法通过异步获得正确的外部值?

javascript - 如何在javascript中按小时/6小时/天/周/月/年对日期对象进行分组

css - 在 div 外显示 Bootstrap 弹出窗口,溢出 :hidden

html - 如何在我的网络应用程序中为所有 Bootstrap 面板的主体设置透明背景

javascript - Bootstrap 弹出窗口在对象中不起作用

jquery - bootstrap popover 内容没有改变

javascript - 使用jquery每3秒显示一次div

javascript - react : 'this.state' is undefined inside a component function

javascript - 使 slider 图像响应 Bootstrap

javascript - 如何设置当前小时下拉列表的默认选择?