JavaScript Dismiss Bootstrap popover by clicking outside dismiss bootstrap popover programmatically,dismiss bootstrap popover,dismiss bootstrap popover

How to dismiss Bootstrap popover by clicking outside the popover. Currently it has toggle for open link.

HTML

 <div class="widget-rating">
          <span class="rateit rating-average"></span>
          <a class="btn btn-mini" target='_blank' href="javascript:void(0)"><b class="caret"></b></a>
 </div>

Here is js code

element.popoverAnchor.popover({
        title: "Rating",
        animation: false,
        html: true,
        content: "Loading...",
        placement: "bottom",
        trigger: "click"
      });
Answer:1
$('body').on('click', function (e) {
    $('.popover-link').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) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) {
            $(this).popover('hide');
        }
    });
});

Reference : http://mattlockyer.com/2013/04/08/close-a-twitter-bootstrap-popover-when-clicking-outside/

Answer:2

I am develop an app using GWT Maps Api V3. I try create Place search box like example of Google Maps JavaScript API(link Place search box - Google Maps JavaScript API ) I have viewed the javascript ...

I am develop an app using GWT Maps Api V3. I try create Place search box like example of Google Maps JavaScript API(link Place search box - Google Maps JavaScript API ) I have viewed the javascript ...

What is the difference between I know here the global jQuery is passed as $ to function, (function($){ })(jQuery); and this one $(function(){ })();

What is the difference between I know here the global jQuery is passed as $ to function, (function($){ })(jQuery); and this one $(function(){ })();

  1. anonymous function javascript es6
  2. anonymous function javascript example
  3. anonymous function javascript arrow
  4. anonymous function javascript mdn
  5. anonymous function javascript this
  6. anonymous function javascript error
  7. anonymous function javascript syntax
  8. anonymous function javascript onclick
  9. anonymous function javascript w3schools
  10. anonymous function javascript arguments
  11. anonymous function javascript advantages
  12. anonymous function javascript self executing
  13. anonymous function javascript with parameter
  14. anonymous function javascript callback
  15. anonymous function javascript use
  16. anonymous function javascript return
  17. anonymous function javascript scope
  18. anonymous function javascript pass variable
  19. anonymous function javascript call
  20. anonymous function javascript la gi

I have the following problem. I have this JSON feed set up: https://api.myjson.com/bins/1ukdk And I'm trying to iterate through the source to eventually output to html. $.getJSON('https://api....

I have the following problem. I have this JSON feed set up: https://api.myjson.com/bins/1ukdk And I'm trying to iterate through the source to eventually output to html. $.getJSON('https://api....

Is there a recommended way to make an AJAX call within a WebForms application? I know there is the built-in ASP.NET AJAX components, but they seem a bit heavy. I'm used to doing this in MVC and it ...

Is there a recommended way to make an AJAX call within a WebForms application? I know there is the built-in ASP.NET AJAX components, but they seem a bit heavy. I'm used to doing this in MVC and it ...

  1. best way to make ajax calls