javascript - How to close one modal popup when another one is active -


i trying modal popup window modal popup window. when click link first popup window, second popup window opening, first 1 not getting closed.

how can this?

jquery:

 $(".get-me-license").click(function(){     $("#license").modal('show');  });   $(".confirm-my-license").click(function(){     $("#confirm-license").modal('show');  }); 

html:

<div id="license" class="modal fade">         <div class="modal-dialog">             <div class="modal-content">                 <div class="modal-body">                   <img class="modal-cont" src="images/license-popup.png">                  <table class="get-license-confirm">                    <tr>                     <td><a href="#" class="btn btn-warning confirm-my-license">get license</a></td>                   </tr>                 </table>                  </div>                             </div>         </div>  </div>  <div id="confirm-license" class="modal fade">         <div class="modal-dialog">             <div class="modal-content">                 <div class="modal-body">                   <img class="modal-cont" src="images/license-popup.png">                  <table class="get-license-confirm">                    <tr>                     <td><a href="#" class="btn btn-warning">confirm</a></td>                   </tr>                 </table>                  </div>                             </div>         </div>  </div> 

you can try 2 methods

to hide modal:

$('.yourmodalelement').modal('hide'); 

or totally destroy modal instance, can try one:

$('.yourmodalelement').data('modal', null); 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -