Reputation: 7004
I want to call modal("hide")
in a 'silent' way - i.e. not to trigger the event handlers which I attached using .on("hidden.bs.modal")
. How?
Upvotes: 1
Views: 244
Reputation: 31
Maybe you could use a var isSilent inside your on hide event and have an if silent do nothing else do stuff, rather than trying to unbind events.
Upvotes: 1
Reputation: 4825
I would unbind the event handler, hide the modal, and then re-bind the event handler. See this question for the best ways to remove an event handler.
The answer demonstrates using the jquery off()
function like so:
$('#myimage').on('click.mynamespace', function() { /* Do stuff */ });
$('#myimage').off('click.mynamespace');
Temporarily override your trigger somewhere in your code, and then remove that piece of code when you are done:
.on("hidden.bs.modal") {
//do nothing
}
Upvotes: 0