[RESOLVED]Bootstrap popover

Hi All,

I have a dropdown which got two values 1 & 2 when "2" is selected i have to show the popover on a checkbox  and if click on something else the popover should be invisible

This is my Pop

        <div data-content="This is my content"
             class="popover-toggle" data-trigger="focus" data-toggle="popover" data-placement="bottom" 
              data-container="body" >
        </div> 

at present when I select the option 2 the popver is displayed but it never gets closed when clicked somewhere else.

this is Jquery 

 $("ddlchange").on("change", function () {
            if ($("ddlchange").val() == "2") {
                $(function () { $('.popover-toggle').popover('toggle'); });               
            }
            else
            {
                $(function () { $('.popover-toggle').popover('hide'); });
            }
           
        });

What I am I missing ?

Please help

Hi,

use document click, to hide when clicked anywhere else.

$(document).click(function(event) {
 $(function () { $('.popover-toggle').popover('hide'); });
 });

Leave a Reply