# Modal close definition

**URL:** <https://forum.bootstrapstudio.io/t/modal-close-definition/11085>\
**Category:** Bootstrap Studio Help\
**Created:** [February 27, 2024, 9:29am UTC](https://forum.bootstrapstudio.io/t/modal-close-definition/11085 "2024-02-27T09:29:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wing2005](https://forum.bootstrapstudio.io/letter_avatar_proxy/v4/letter/w/43a26b/32.png) [@Wing2005](https://forum.bootstrapstudio.io/u/Wing2005)\
**Post date:** [February 27, 2024, 9:29am UTC](https://forum.bootstrapstudio.io/t/modal-close-definition/11085/1 "2024-02-27T09:29:28Z")

</div>

I created a modal popup with 4 checkboxes and the 2 generic buttons. My intention is to be able to multi-select 0-4 of these checkboxes. Characteristic of the basic modal is to get closed by the first click. In consequence, I have to open the modal 4 times to have all 4 checkboxes modified. Is there any possibility to only close the modal by clicking one of the 2 buttons (close/save)? Why the popup is closed by the checkboxes?

Thank you for any help!!

Best regards  
Steffen

---

<div class="post-metadata">

**Author:** ![richards](https://forum.bootstrapstudio.io/user_avatar/forum.bootstrapstudio.io/richards/32/3163_2.png) [@richards](https://forum.bootstrapstudio.io/u/richards)\
**Post date:** [February 27, 2024, 2:42pm UTC](https://forum.bootstrapstudio.io/t/modal-close-definition/11085/2 "2024-02-27T14:42:18Z")

</div>

A standard modal will not close unless the close button, the ‘x’ or outside of the modal are clicked. Have you modified any code at all, maybe you have a stretched-link class added to a button?

Example of standard modal with form:

[https://modal-checkbox.bss.design/](https://modal-checkbox.bss.design/)

---

<div class="post-metadata">

**Author:** ![Wing2005](https://forum.bootstrapstudio.io/letter_avatar_proxy/v4/letter/w/43a26b/32.png) [@Wing2005](https://forum.bootstrapstudio.io/u/Wing2005)\
**Post date:** [February 27, 2024, 7:23pm UTC](https://forum.bootstrapstudio.io/t/modal-close-definition/11085/3 "2024-02-27T19:23:29Z")

</div>

Not sure about the difference… just deleted the modal-form and created a new one w/o any code modification it closes wherever I click. I do not open it via button but linked the button role to a div:

```auto
<div data-bs-toggle="modal" href="#modal-speaker" role="button">
                                <div class="row" style="height: 50px;">
                                    <div class="col" style="height: 50px;"><img style="width: 40px;height: 38px;margin: 0px;margin-top: 19px;margin-left: -5px;margin-right: 0px;padding-top: 0px;" src="assets/img/Logo-Speakers.png"></div>
                                </div>
                                <div class="row" style="height: 50px;">
                                    <div class="col" style="height: 50px;margin-top: 0px;"><label class="col-form-label" style="color: var(--swiper-theme-color);font-family: 'ADLaM Display', serif;font-size: 15px;text-align: center;padding-top: 10px;height: 50px;">Speaker</label></div>
                                </div>
                                <div class="modal fade" role="dialog" tabindex="-1" id="modal-speaker">
                                    <div class="modal-dialog" role="document">
                                        <div class="modal-content">
                                            <div class="modal-header">
                                                <h4 class="modal-title">Modal Title</h4><button class="btn-close" type="button" aria-label="Close" data-bs-dismiss="modal"></button>
                                            </div>
                                            <div class="modal-body">
                                                <p>The content of your modal.</p>
                                            </div>
                                            <div class="modal-footer"><button class="btn btn-light" type="button" data-bs-dismiss="modal">Close</button><button class="btn btn-primary" type="button">Save</button></div>
                                        </div>
                                    </div>
                                </div>
                            </div>

```

In this example I did not add checkboxes. But as the modal-window closes on every click, it must be something wrong with the fundamental structure.

Thanks for your help!!

---

<div class="post-metadata">

**Author:** ![kuligaposten](https://forum.bootstrapstudio.io/user_avatar/forum.bootstrapstudio.io/kuligaposten/32/1190_2.png) [@kuligaposten](https://forum.bootstrapstudio.io/u/kuligaposten)\
**Post date:** [February 27, 2024, 7:38pm UTC](https://forum.bootstrapstudio.io/t/modal-close-definition/11085/4 "2024-02-27T19:38:34Z")

</div>

You have the modal inside the toggle. Move the modal outside the div with the attribute `data-bs-toggle="modal"`

---

<div class="post-metadata">

**Author:** ![Wing2005](https://forum.bootstrapstudio.io/letter_avatar_proxy/v4/letter/w/43a26b/32.png) [@Wing2005](https://forum.bootstrapstudio.io/u/Wing2005)\
**Post date:** [February 27, 2024, 8:29pm UTC](https://forum.bootstrapstudio.io/t/modal-close-definition/11085/5 "2024-02-27T20:29:40Z")

</div>

Argh… Thank you very much!!  
No it behaves correct!

Best regards  
Steffen
