Close bootstrap modal without using “hide” and “data-dismiss”

前端 未结 2 1239
盖世英雄少女心
盖世英雄少女心 2020-12-14 20:25

I want to close bootstrap modal box conditionally. If I use $(\'#modal\').modal(\'hide\'); this, some thing goes wrong with my code. And If I use data-di

2条回答
  •  一向
    一向 (楼主)
    2020-12-14 21:07

    Make another button like this

    
    

    This button contains data-dismiss="modal" .You can hide this if you want.

    Now You can use any other function in a customized way and when you want to hide the modal you can call

    $(".btn-warning").click();
    

提交回复
热议问题