modal popup closing automatically code example
Example 1: when modal close event
$("yourid").on('hide.bs.modal', function(){
// do it here
});
Example 2: do not close dialog box when click outside bootstrap modal
<div id="idModal" class="modal hide" data-backdrop="static" data-keyboard="false">