Bootstrap 3 Modal: how to check if modal is open or closed using jquery/javascript

后端 未结 5 1095
陌清茗
陌清茗 2021-02-01 21:15

Can anyone please tell me how to check bootstrap 3.0 modal status, is it open or closed using jQuery or javascript. I used following code but it works when you have opened a mod

5条回答
  •  攒了一身酷
    2021-02-01 21:21

    I used the following code for my AJAX Call. After a setTimeout i tried to close the model properly and used the is() method for doing so. Hope it helps somebody.

    complete: function(){
            setTimeout(function() {
                // model
                if($('#mdlNewOrder').is(':visible')) {
                    $('#mdlNewOrder').modal('toggle');
                }
                //buttons
                $('#btn_closeNewOrder').prop("disabled", false);
                $('#btn_NewOrder').prop("disabled", false);
                // table reload
                $('#table_patientlist').DataTable().ajax.reload(null, false);
            }, 2800);
        }
    

提交回复
热议问题