Jquery 在实际popover中关闭引导popover?

Jquery 在实际popover中关闭引导popover?,jquery,html,twitter-bootstrap,button,popover,Jquery,Html,Twitter Bootstrap,Button,Popover,我正在使用Twitter引导弹出框来确认删除特定表行的警报,但似乎无法让弹出框中的按钮影响任何内容。我已经复制了确切的“取消”按钮外的流行音乐,它的作品很好 HTML <span class="glyphicon glyphicon-trash icon-set delLtBlue delPop" title='Delete' data-content=" <div style='font-size: 14px; color: #0000

我正在使用Twitter引导弹出框来确认删除特定表行的警报,但似乎无法让弹出框中的按钮影响任何内容。我已经复制了确切的“取消”按钮外的流行音乐,它的作品很好

HTML

<span class="glyphicon glyphicon-trash icon-set delLtBlue delPop" title='Delete' 
          data-content="
            <div style='font-size: 14px; color: #000000; font-weight:bold'>
              <span class='icon-warning-2'></span>&nbsp;Are you sure you want to delete the selected row?<br/><br/>
            </div>  
            <input type='button' value='Cancel' class='greenBtn cancelPop' />&nbsp;<input type='button' value='Delete' class='greenBtn' id='delete' />
          " title="Delete"></span>&nbsp;

有什么想法吗?提前感谢。

问题是,当您将引导popover与html内容一起使用时,它实际上克隆了popover div内
数据内容中的内容。因此,这意味着注册到原始取消的事件不适用于popover中创建的新取消按钮,因为这个
数据内容
的内容只是属性值,而不是DOM中的真实元素。因此,您可以使用事件委派将单击事件绑定到文档(因为它位于根级别),以便通过取消按钮委派它

$(document).on('click',"input[type=button].cancelPop", function () {
    $(".delPop").popover('hide');
});

但是,等一下。您不需要这样放置popover内容。您可以将html原样放在页面上,隐藏它们

更好的方法是:将内容分离到不同的隐藏元素,而不是将整个html放在一个属性中

<span class="glyphicon glyphicon-trash icon-set delLtBlue delPop" title='Delete'></span> &nbsp;
<div class="popOverContent">
    <div style='font-size: 14px; color: #000000; font-weight:bold'>
<span class='icon-warning-2'></span>&nbsp;Are you sure you want to delete the selected row?
        <br/>
        <br/>
    </div>
    <input type='button' value='Cancel' class='greenBtn cancelPop' />&nbsp;
    <input type='button' value='Delete' class='greenBtn' id='delete' />
</div>

非常感谢您。非常有帮助。@triplethreat77不客气。顺便说一下,在原始html中,如果整个部分包含在另一个元素中,那么在事件委托中,您可以绑定到该元素而不是文档。
<span class="glyphicon glyphicon-trash icon-set delLtBlue delPop" title='Delete'></span> &nbsp;
<div class="popOverContent">
    <div style='font-size: 14px; color: #000000; font-weight:bold'>
<span class='icon-warning-2'></span>&nbsp;Are you sure you want to delete the selected row?
        <br/>
        <br/>
    </div>
    <input type='button' value='Cancel' class='greenBtn cancelPop' />&nbsp;
    <input type='button' value='Delete' class='greenBtn' id='delete' />
</div>
$(function () {
     $(document).on('click', "input[type=button].cancelPop", function () {
        $(".delPop").popover('hide');
    });

    $('.delPop').popover({
        placement: 'bottom',
        html: true,
        content: function () {
            return $('.popOverContent').html();
        }
    });

});