Can I check if Bootstrap Modal Shown / Hidden?

前端 未结 11 1442
走了就别回头了
走了就别回头了 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:08

    Use hasClass('in'). It will return true if modal is in OPEN state.

    E.g:

    if($('.modal').hasClass('in')){
       //Do something here
    }
    

提交回复
热议问题