title: Multiple buttons and multiple modals of the same class, show one modal when clicked
body: <p>I need to make a modal appear when a button is clicked, I have multiple buttons and modals of the same class. I wrote a small jQuery code, but when I click any button all modals appear at once. I need somehow to make appear only the corresponding modal when the corresponding button is clicked. But once again, I have the same classes for all the buttons and modals.</p>
  
  <p>I wrote a simplified demo, so that it was more clear:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$("button").click(function() {
      $( ".modal" ).addClass("active");
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>body {
    padding: 20px;
  }
  
  .container {
    margin: 30px;
  }
  
  .modal {
      display: none;
      padding: 15px;
      position: relative;
      background: rgba(72, 72, 72, 0.95);
      color: #fff;
      width: 12vw;
      height: 80px;
      right: 0;
      margin: 10px;
      border-radius: 3px;
  }
  
  .modal.active {
    display: block;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;div class="container"&gt;
    &lt;button&gt;open modal&lt;/button&gt;
    &lt;div class="modal"&gt;modal&lt;/div&gt;
  &lt;/div&gt;
  
  &lt;div class="container"&gt;
    &lt;button&gt;open modal&lt;/button&gt;
    &lt;div class="modal"&gt;modal&lt;/div&gt;
  &lt;/div&gt;
  
  &lt;div class="container"&gt;
    &lt;button&gt;open modal&lt;/button&gt;
    &lt;div class="modal"&gt;modal&lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Thanks.</p>