title: Bootstrap popover, hide on click outside?
body: <p>using bootstrap popover, and now  im trying to get this code to click outside the popover to close the popover:</p>
  
  <pre><code>$('body').on('click', function (e) {
      $('[data-toggle="popover"]').each(function () {
          //the 'is' for buttons that trigger popups
          //the 'has' for icons within a button that triggers a popup
          if (!$(this).is(e.target) &amp;&amp; $(this).has(e.target).length === 0 &amp;&amp; $('.popover').has(e.target).length === 0) {
              $(this).popover('hide');
          }
      });
  });
  </code></pre>
  
  <p>But when i use this part, i can close the popover but i cant click the other buttons, anyone got any idea how i can do that? </p>
  
  <p>All the buttons: </p>
  
  <pre><code>&lt;a href="#" class="btn btn-xs btn-primary" data-toggle="popover"&gt;This opens popover&lt;/a&gt;
  &lt;a href="#" class="btn btn-xs btn-primary"&gt;Other link&lt;/a&gt; &lt;- Doesn't work 
  &lt;a href="#" class="btn btn-xs btn-primary"&gt;Other link&lt;/a&gt; &lt;- Doesn't work 
  </code></pre>