How to check if bootstrap modal is open, so I can use jquery validate?
To avoid the race condition @GregPettit mentions, one can use: ($(“element”).data(‘bs.modal’) || {})._isShown // Bootstrap 4 ($(“element”).data(‘bs.modal’) || {}).isShown // Bootstrap <= 3 // or, with the optional chaining operator (?.) $(“element”).data(‘bs.modal’)?._isShown // Bootstrap 4 $(“element”).data(‘bs.modal’)?.isShown // Bootstrap <= 3 as discussed in Twitter Bootstrap Modal – IsShown. When the modal is not yet opened, … Read more