Keep Bootstrap dropdown open on click

后端 未结 7 984
我寻月下人不归
我寻月下人不归 2020-12-08 01:54

I use a bootstrap dropdown as a shoppingcart. In the shopping cart is a \'remove product\' button (a link). If I click it, my shoppingcart script removes the product, but th

相关标签:
7条回答
  • 2020-12-08 02:25

    I was having the same problem with an accordion/toggle sub-menu that was nested within a dropdown-menu in Bootstrap 3. Borrowed this syntax from the source code to stop all collapse toggles from closing the dropdown:

    $(document).on(
        'click.bs.dropdown.data-api', 
        '[data-toggle="collapse"]', 
        function (e) { e.stopPropagation() }
    );
    

    You can replace [data-toggle="collapse"] with whatever you want to stop closing the form, similar to how @DonamiteIsTnt added a property to do so.

    0 讨论(0)
提交回复
热议问题