Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Bootstrap 5 modal not closing

I must be doing something silly.

I am programmatically opening a modal using $("#exampleModal").show();

The modal opens correctly.
But for some reason – i do not get the dark overlay behind the modal – and the 2 close buttons do not work.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I had the class ‘fade’ applied as in the sample, but it meant the modal would not open at all.

JSFIDDLE: https://jsfiddle.net/kneidels/x9zwfumt/

>Solution :

Here you go…

Change $("#exampleModal").show(); to $("#exampleModal").modal("show");. It solves everything you mentioned.

See the forked JSFiddle here.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading