Answer the question
In order to leave comments, you need to log in
How to call different JS code when opening modal windows?
Good day. There are several standard Bootstrap modal windows, called by pressing buttons, how to make it so that when one modal window is active, one JS script is executed, when another, another script.
And the problem is that the script would be executed not only at the time of the "click", but while the modal window is open.
Answer the question
In order to leave comments, you need to log in
Take advantage of the event
$('#exampleModal').on('show.bs.modal', function (event) {
console.log($(this))
})
$('#exampleModal')
.modal('show')
.on('show.bs.modal', function (event) {
console.log($(this))
})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question