T
T
ti_cho2016-04-25 23:40:58
JavaScript
ti_cho, 2016-04-25 23:40:58

How to stop a script from running until a button is pressed (Javascript)?

There is a normal bootstrap modal window, I want to confirm the closing, that is, when the user wants to close the modal window, the second modal window pops up with a warning "Are you sure you want to close the contract window? yes/no". The bootstrap has an event for closing the window, as well as an action for opening, I did this

$('#modal').on('hide.bs.modal', function (e) {
$('#modal2').modal('show');
});

But when you start to close the first mod. window, the second one appears, but at this time the first one closes completely, how to make it so that there is something like
$('#modal').on('hide.bs.modal', function (e) {
alert ('Вы точно хотите закрыть окно договора?');
});

That is, so that the first window does not close until the user presses the yes / no buttons?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel K, 2016-04-26
@PavelK

Well, put the event not on closing the window, but on clicking on the close button and complete the propaganda of events.
Therefore, depending on the decision, close the first one yourself or not.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question