Reputation: 16017
I'm creating my modal with the escape key and backdrop disabled by default
$(modal).modal({
backdrop: "static",
keyboard: false
});
Then some time later I wanna enable them
$(modal).modal({
backdrop: true,
keyboard: true
});
But when I click on the backdrop or press escape nothing happens. I could recreate the entire modal but that looks broken, clumsy and hacky. How do I do this properly?
Upvotes: 0
Views: 891
Reputation: 2142
I figured out boostrap 4 change structure of configuration. You should use
$('#basicModal').data('bs.modal')._config.keyboard = true;
$('#basicModal').data('bs.modal')._config.backdrop = true;
See the https://codepen.io/anon/pen/rvmvQB
Upvotes: 1