Can I check if Bootstrap Modal Shown / Hidden?

前端 未结 11 1481
走了就别回头了
走了就别回头了 2020-12-05 12:29

Can I check if Bootstrap Modal currently Shown / Hidden Programatically?

Like bool a = if(\"#myModal\").shown(); ?

I need true/false

11条回答
  •  不知归路
    2020-12-05 13:20

    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

提交回复
热议问题