title: How to make a modal inside another one and the last one to disappear when another one is open in Jquery
body: <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>        $(function() {
      //----- OPEN
      $('[data-popup-open]').on('click', function(e)  {
          var targeted_popup_class = jQuery(this).attr('data-popup-open');
          $('[data-popup="' + targeted_popup_class + '"]').fadeIn(350);
   
          e.preventDefault();
      });
   
      
  
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.popup {
      width:500px;
      height:500px;
      display:none;
      position:fixed;
      top:0px;
      left:0px;
      background:rgba(193, 49, 49, 0.55);
      z-index: 99;
  }
  .popup-1{
      width:500px;
      height:500px;
      display:none;
      position:fixed;
      top:0px;
      left:0px;
      background:green;
      z-index: 99;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="popup-1" data-popup="popup-2"&gt;
    &lt;button type="button"&gt;&lt;a class="btn" data-popup-open="popup-1" href="#"&gt;Regjistrohu&lt;/a&gt;&lt;/button&gt;
  &lt;/div&gt;
  &lt;div class="popup" data-popup="popup-1"&gt;
    &lt;button type="button"&gt;&lt;a class="btn" data-popup-open="popup-2" href="#"&gt;login&lt;/a&gt;&lt;/button&gt;
  &lt;/div&gt;
  &lt;button type="button"&gt;&lt;a class="btn" data-popup-open="popup-2" href="#"&gt;add&lt;/a&gt;&lt;/button&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Hello I'm  doing  a login and register  form like a modal in Jquery  when i click to login inside register modal  it work but when I try to register in login modal i doesn't work  also i want to disappear one off them when another one is active. so far her is my code:  <a href="http://codepen.io/xhepigerta/pen/vGRdvb" rel="nofollow">http://codepen.io/xhepigerta/pen/vGRdvb</a>
  Can someone help me please?   thanks </p>