Twitter bootstrap modal - change option for existing modal

I want to change modal behavior after a specific event.

$('.myModal').modal('show'); // default behavior - user can close modal on ESC $(button).click(function(){ $('.myModal').modal({keyboard:false}); // override // prevous line code does not work as i expect, // user can close modal with ESC $('.myModal').data('modal').option.keyboard = false; // even this code doesn't work }); 

Any help would be appreciated

+4
source share
1 answer

I had the same problem, I used the wrong data ...

You can try with this (considering bt3):

 $('#myModal').data('bs.modal').options.keyboard=false; 

But

This does not work if the modal is open, you need to update it.

+1
source

Source: https://habr.com/ru/post/1415152/


All Articles