Can I check if Bootstrap Modal Shown / Hidden?
问题 Can I check if Bootstrap Modal currently Shown / Hidden Programatically? Like bool a = if("#myModal").shown(); ? I need true/false 回答1: alert($('#myModal').hasClass('in')); It will return true if modal is open 回答2: The best method is given in the docs $('#myModal').on('shown.bs.modal', function () { // will only come inside after the modal is shown }); for more info refer http://getbootstrap.com/javascript/#modals 回答3: its an old question but anyway heres something i used incase someone was