Modal popup from javascript

We are recently migrated to the new theme. Popup goes off when clicking outside the modal popup window. Below is the code to open the model. Please help.

$("#testDialog").modal('show');

<div class="modal fade" data-backdrop="static" tabindex="-1" role="dialog" aria-labelledby="staticBackdrop" >...</div>


Suresh

Text formatting options
Submit

Replies (9)

Hi,

Could you please clarify? Which popup are you using? SweetAlert ?

Can you please send us some screenshots via using https://imgur.com ?

Regards

Hi

https://imgur.com/7ZhD30o

This is the modal I am using. But when I click outside the popup , it goes off. I want the popup there evenif user click outside the popup. I added data-backdrop="static" property, but it is not working . I am using the purchased version of plugins.bundle.js file. But in the demo site, it is working fine. Do I need to change the js file ?

thanks
Suresh

Hi,

You will need to use Bootstrap 5 new attributes data-bs-backdrop="static" data-bs-keyboard="false" attributes to show a modal with static backdrop as explained in the Modal documentation.

Regards.

Thank you... This is working...

Below is the full html ...


function openModal()
{
$("#staticBackdrop").modal('show');
}

https://imgur.com/WtHjXIj

this is the html

This seems to be an issue now. I tried with most of the js and css files which downloaded , however popup still disappears if click out side. I exactly did the same as in the document, but no luck. If needed, I can send the files which I am testing for this. Please let me know. This is really a headache now.

Have you tried to use data-bs-backdrop="static" data-bs-keyboard="false" attributes to show a modal with static backdrop ?

yes, I tried and working. Thank you.

Text formatting options
Submit
Text formatting options
Submit