Abhinav
Abhinav

Reputation: 89

How to prevent bootstrap modal to open when a modal is active

I have multiple modal in my project and some modal will open via javascript. I need if any modal is in open state no other modal will open. How can we do this?

Upvotes: 0

Views: 361

Answers (1)

li0n_za
li0n_za

Reputation: 455

If you are going to launch all your modals via javascript/jquery then you can check with

if ($('.modal .in').length() > 0) {
    //at least one open modal detected
    return;
else {
    //show modal
}

Upvotes: 1

Related Questions