Home Need to close below dropdown when click on other popover button
Reply: 1

Need to close below dropdown when click on other popover button

Mahesh Chowdary
Mahesh Chowdary Published in 2017-11-14 17:52:24Z

I need to close the dropdown when I click on another popover button

Mayur Agarwal
Mayur Agarwal Reply to 2017-11-14 18:19:55Z

you can try this in many ways:

simplest one in angularJs itself by adding a ng-click in your button which will change the value of show :

 <button class="btn btn-primary dropdown-toggle" type="button" ng-click="show=0">


you can add some id to your button so it will be captured easily, e.g.

<button class="btn btn-primary dropdown-toggle" type="button" id="hideDropdown">

and can try with given solutions:


$(document).on('click', function(evt) {
    if($(evt.target).is('#hideDropdown')) {
        // Hide code
        // e.g. show=0;
    } });

you can try with Javascript

document.getElementById('hideDropdown').onclick = function(e){
        // Hide code
        // e.g. show=0;

or AngularJs itself by using a directive

YourApp.directive('testClick', function () {
    return {
        restrict: 'A',
        link: function (scope, element) {
            element.onclick = function() {
                //do some thing.

*html code*

<button test-click>Test Click</button>   

you may need to change the conditions as per your requirements as it is a rough code.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.326324 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO