title: Close the pop up that opens if you open another pop up
body: <p>Hy, I made several pop ups. To close the pop up by press the opened popup. I want to make if you open a new pop up then another pop up that appears is closed.</p>
  
  <blockquote>
    <p>For example if I open a pop up 1. then I open the pop up 2, then when the pop up 2 opens the pop up 1 is closed</p>
  </blockquote>
  
  <p>here my html code </p>
  
  <pre><code>&lt;body style="text-align:center"&gt;
  &lt;br&gt;&lt;br&gt;&lt;br&gt;
  &lt;div class="popup" onclick="popUp1()"&gt;Click me!
    &lt;span class="popuptext" id="myPopup1"&gt;Popup 1&lt;/span&gt;
  &lt;/div&gt;
  &amp;nbsp; &amp;nbsp; &amp;nbsp;
  &lt;div class="popup" onclick="popUp2()"&gt;Click me!
    &lt;span class="popuptext" id="myPopup2"&gt;Popup 2&lt;/span&gt;
  &lt;/div&gt;
  
  &amp;nbsp; &amp;nbsp; &amp;nbsp;
  &lt;div class="popup" onclick="popUp3()"&gt;Click me!
    &lt;span class="popuptext" id="myPopup3"&gt;Popup 3&lt;/span&gt;
  &lt;/div&gt;
  
  &lt;script&gt;
  function popUp1() {
      var popup = document.getElementById("myPopup1");
      popup.classList.toggle("show");
  }
  
  function popUp2() {
      var popup = document.getElementById("myPopup2");
      popup.classList.toggle("show");
  }
  
  function popUp3() {
      var popup = document.getElementById("myPopup3");
      popup.classList.toggle("show");
  }
  &lt;/script&gt;
  
  &lt;/body&gt;
  </code></pre>
  
  <p>Here my css</p>
  
  <pre><code>.popup {
    position: relative;
    display: inline-block;
    cursor: pointer;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
  }    
  .popup .popuptext {
    visibility: hidden;
    width: 160px;
    background-color: #555;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px 0;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -80px;
  }
  .popup .popuptext::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #555 transparent transparent transparent;
  }    
  .popup .show {
    visibility: visible;
    -webkit-animation: fadeIn 1s;
    -moz-animation: fadeIn 1s;
    -ms-animation: fadeIn 1s;
    animation: fadeIn 1s;
  }    
  @keyframes fadeIn {
      from { opacity: 0; }
      to { opacity:1 ; }
  }
  </code></pre>
  
  <p>Thank you</p>