title: How to make dynamic collapse with bootstrap
body: <p>I am using bootstrap, ejs and nodejs.
  Trying to list my array values with collapse component. I can get every component in collapse so it is working. The thing that I don't want, when I click one of the collapse all of them opens and when click again to one of them all of them collapse and close. I want to see them one by one, so whenever I click one of them I want to see only one of them.</p>
  
  <pre><code>&lt;%- include('includes/head.ejs') %&gt;&lt;link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css"&gt;
  &lt;link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700"&gt;
  &lt;link rel="stylesheet" href="assets/css/Contact-Form-Clean.css"&gt;
  &lt;link rel="stylesheet" href="assets/css/Header-Blue.css"&gt;
  &lt;link rel="stylesheet" href="assets/css/styles.css"&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
  &lt;div&gt;
      &lt;div class="header-blue"&gt;
          &lt;nav class="navbar navbar-dark navbar-expand-md navigation-clean-search"&gt;
              &lt;div class="container"&gt;&lt;a class="navbar-brand" href="/"&gt;Agenda App&lt;/a&gt;
                  &lt;button data-toggle="collapse" class="btn btn-link collapsed" data-target="#navcol-1"&gt;&lt;span class="sr-only"&gt;Toggle navigation&lt;/span&gt;&lt;span
                              class="navbar-toggler-icon"&gt;&lt;/span&gt;&lt;/button&gt;
                  &lt;div class="collapse navbar-collapse"
                       id="navcol-1"&gt;
                      &lt;ul class="nav navbar-nav"&gt;
                          &lt;li class="nav-item" role="presentation"&gt;&lt;a class="nav-link" href="/"&gt;Home Page&lt;/a&gt;&lt;/li&gt;
                          &lt;li class="nav-item" role="presentation"&gt;&lt;a class="nav-link active" href="/addresses"&gt;Addresses&lt;/a&gt;&lt;/li&gt;
                      &lt;/ul&gt;
                      &lt;form class="form-inline mr-auto" target="_self"&gt;
                          &lt;div class="form-group"&gt;&lt;input class="form-control search-field" type="search" id="search-field"
                                                         name="search"&gt;&lt;/div&gt;
                      &lt;/form&gt;
                      &lt;span class="navbar-text"&gt; &lt;a class="login" href="#"&gt;Log In&lt;/a&gt;&lt;/span&gt;&lt;a
                              class="btn btn-light action-button" role="button" href="#"&gt;Sign Up&lt;/a&gt;&lt;/div&gt;
              &lt;/div&gt;
          &lt;/nav&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;div role="tablist" id="accordion-1" style="margin: 5% 0 ;" class="accordion"&gt;
      &lt;% if (contactsArray.length &gt; 0) { %&gt;
          &lt;% for (let contact of contactsArray) { %&gt;
              &lt;div class="card"&gt;
                  &lt;div class="card-header" role="tab"&gt;
                      &lt;h5 class="mb-0"&gt;&lt;a data-toggle="collapse" aria-expanded="true" aria-controls="accordion-1 .item-1"
                                          href="div#accordion-1 .item-1"&gt;&lt;%= contact.name %&gt;&lt;/a&gt;&lt;/h5&gt;
                  &lt;/div&gt;
                  &lt;div class="collapse show item-1" role="tabpanel" data-parent="#accordion-1"&gt;
                      &lt;div class="card-body"&gt;&lt;strong&gt;Email&lt;/strong&gt;
                          &lt;p&gt;&lt;%= contact.email %&gt;&lt;/p&gt;&lt;strong&gt;Phone Number&lt;/strong&gt;
                          &lt;p&gt;&lt;%= contact.phone %&gt;&lt;/p&gt;&lt;strong&gt;Address&lt;/strong&gt;
                          &lt;p class="card-text"&gt;&lt;%= contact.address %&gt;&lt;/p&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;% } %&gt;
      &lt;% } %&gt;
  &lt;/div&gt;
  &lt;script src="assets/js/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script src="assets/bootstrap/js/bootstrap.min.js"&gt;&lt;/script&gt;
  
  &lt;%- include('includes/end.ejs') %&gt;
  </code></pre>
  
  <p>Generated html code is here</p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;meta name="viewport"
            content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"&gt;
      &lt;meta http-equiv="X-UA-Compatible" content="ie=edge"&gt;
  &lt;link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css"&gt;
  &lt;link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700"&gt;
  &lt;link rel="stylesheet" href="assets/css/Contact-Form-Clean.css"&gt;
  &lt;link rel="stylesheet" href="assets/css/Header-Blue.css"&gt;
  &lt;link rel="stylesheet" href="assets/css/styles.css"&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
  &lt;div&gt;
      &lt;div class="header-blue"&gt;
          &lt;nav class="navbar navbar-dark navbar-expand-md navigation-clean-search"&gt;
              &lt;div class="container"&gt;&lt;a class="navbar-brand" href="/"&gt;Agenda App&lt;/a&gt;
                  &lt;button data-toggle="collapse" class="btn btn-link collapsed" data-target="#navcol-1"&gt;&lt;span class="sr-only"&gt;Toggle navigation&lt;/span&gt;&lt;span
                              class="navbar-toggler-icon"&gt;&lt;/span&gt;&lt;/button&gt;
                  &lt;div class="collapse navbar-collapse"
                       id="navcol-1"&gt;
                      &lt;ul class="nav navbar-nav"&gt;
                          &lt;li class="nav-item" role="presentation"&gt;&lt;a class="nav-link" href="/"&gt;Home Page&lt;/a&gt;&lt;/li&gt;
                          &lt;li class="nav-item" role="presentation"&gt;&lt;a class="nav-link active" href="/addresses"&gt;Addresses&lt;/a&gt;&lt;/li&gt;
                      &lt;/ul&gt;
                      &lt;form class="form-inline mr-auto" target="_self"&gt;
                          &lt;div class="form-group"&gt;&lt;input class="form-control search-field" type="search" id="search-field"
                                                         name="search"&gt;&lt;/div&gt;
                      &lt;/form&gt;
                      &lt;span class="navbar-text"&gt; &lt;a class="login" href="#"&gt;Log In&lt;/a&gt;&lt;/span&gt;&lt;a
                              class="btn btn-light action-button" role="button" href="#"&gt;Sign Up&lt;/a&gt;&lt;/div&gt;
              &lt;/div&gt;
          &lt;/nav&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;div role="tablist" id="accordion-1" style="margin: 5% 0 ;" class="accordion"&gt;
  
  
              &lt;div class="card"&gt;
                  &lt;div class="card-header" role="tab"&gt;
                      &lt;h5 class="mb-0"&gt;&lt;a data-toggle="collapse" aria-expanded="true" aria-controls="accordion-1 .item-1"
                                          href="div#accordion-1 .item-1"&gt;First Contant&lt;/a&gt;&lt;/h5&gt;
                  &lt;/div&gt;
                  &lt;div class="collapse show item-1" role="tabpanel" data-parent="#accordion-1"&gt;
                      &lt;div class="card-body"&gt;&lt;strong&gt;Email&lt;/strong&gt;
                          &lt;p&gt;example@example.com&lt;/p&gt;&lt;strong&gt;Phone Number&lt;/strong&gt;
                          &lt;p&gt;99999999&lt;/p&gt;&lt;strong&gt;Address&lt;/strong&gt;
                          &lt;p class="card-text"&gt;Example address&lt;/p&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
  
              &lt;div class="card"&gt;
                  &lt;div class="card-header" role="tab"&gt;
                      &lt;h5 class="mb-0"&gt;&lt;a data-toggle="collapse" aria-expanded="true" aria-controls="accordion-1 .item-1"
                                          href="div#accordion-1 .item-1"&gt;Example 2&lt;/a&gt;&lt;/h5&gt;
                  &lt;/div&gt;
                  &lt;div class="collapse show item-1" role="tabpanel" data-parent="#accordion-1"&gt;
                      &lt;div class="card-body"&gt;&lt;strong&gt;Email&lt;/strong&gt;
                          &lt;p&gt;example2@example2.com&lt;/p&gt;&lt;strong&gt;Phone Number&lt;/strong&gt;
                          &lt;p&gt;88888888&lt;/p&gt;&lt;strong&gt;Address&lt;/strong&gt;
                          &lt;p class="card-text"&gt;Example 2 address&lt;/p&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
  
  
  &lt;/div&gt;
  &lt;script src="assets/js/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script src="assets/bootstrap/js/bootstrap.min.js"&gt;&lt;/script&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>