27 March 2017

How To Disable Bootstrap Modal Window from Closing

In any ordinary day when I need to disable the bootstrap modal window from closing due to my client requirement, I simply make the backdrop to 'static' and set the keyboard property to 'false' like the below sample:

<script type="text/javascript">
    $('#sampleModal').modal({
    backdrop: 'static',
    keyboard: false
    });
</script>


<div class="modal fade" id="sampleModal" tabindex="-1" role="dialog" aria-labelledby="sampleModalLabel" aria-hidden="true">

//some text are omitted here for brevity....

</div>



No comments:

Post a Comment