Javascript 如何使用focus bootstrap popover?

Javascript 如何使用focus bootstrap popover?,javascript,php,twitter-bootstrap,Javascript,Php,Twitter Bootstrap,我有一件像这样的府绸。我需要它作为焦点,当我点击quantity字段时,它就会消失,因为链接没有焦点 代码如下: var popover = $("[data-toggle=popover]").popover({ trigger : 'focus', placement : 'right', container: 'body', html: 'true' }).on('show.bs.popove

我有一件像这样的府绸。我需要它作为焦点,当我点击quantity字段时,它就会消失,因为链接没有焦点

代码如下:

var popover = $("[data-toggle=popover]").popover({
         trigger : 'focus',  
         placement : 'right',
         container: 'body',
         html: 'true'
          }).on('show.bs.popover', function() { 
         product_id = $(this).attr('data-product-id');
         popover = $(this);
         $.ajax({
             url : '/product/short_description/' + product_id, 
             success : function(html) {
                 popover_id = popover.attr('aria-describedby');
                 $('#' + popover_id + ' .popover-content').html(html);
             }
          });
        });
试试这个:

var popover = $("[data-toggle=popover]").popover({
         trigger: 'manual',  
         placement : 'right',
         container: 'body',
         html: 'true'
          }).on('show.bs.popover', function() { 
         product_id = $(this).attr('data-product-id');
         popover = $(this);
         $.ajax({
             url : '/product/short_description/' + product_id, 
             success : function(html) {
                 popover_id = popover.attr('aria-describedby');
                 $('#' + popover_id + ' .popover-content').html(html);
             }
          });
        }).click(function(e){ 
$(this).popover('show');
e.preventDefault(); 
}).addClass('mypopover');
然后:

$('html').click(function() {
$(".mypopover").hide();
});

$('.mypopover').click(function(event){
    event.stopPropagation();
});

这更像是“悬停”。我不能这么做。需要点击链接显示一个popover,然后点击数量,输入一个数字,然后如果我点击页面上的任何地方,除了popover,它就会消失。现在它叫popover。当我点击任何东西时,甚至在popover上,所有的链接都消失了。我无法隐藏那件府绸)