title: Modal image using JS
body: <p>I am trying to create a modal image so that when you click on the image it opens the image bigger in a pop up.</p>
  
  <p>The code I have (see below) only allows me to open only one image in a pop up. it does not allow me to open the rest of the images,</p>
  
  <p>HTML</p>
  
  <pre><code>&lt;section id="responsive"&gt;
      &lt;div class="container"&gt;
                              &lt;div class="row text-center"&gt;
                                  &lt;h2 class="os-animation" data-os-animation="zoomIn" data-os-animation-delay="0.3s"&gt;HOW DOES IT WORK&lt;/h2&gt;
                          &lt;p style="text-align: left"&gt;Exam Portal, enhanced with QFrency SA voices, provides educators with a Quick and Easy to use solution saving them time recording audio, saving parents and schools money hiring Human readers, and enabling learners to bridge a gap where there is nepotism, and an unfair advantage under already stressful testing conditions.&lt;/p&gt;
                  &lt;video  class="innerfour os-animation" data-os-animation="zoomInLeft" data-os-animation-delay="0.6s" width="50%" height="auto" controls&gt;
                      &lt;source src="Videos/main.mp4" type="video/mp4"&gt;
                      Your browser does not support the video tag.
                  &lt;/video&gt;        &lt;br&gt;                        
                              &lt;div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 col-xxs-12"&gt;
                                  &lt;div class="testimonial-content"&gt;
                                  &lt;h2 style="color:#37cdff" class="feature-content-title blue-text"&gt;&lt;span class="blue"&gt;1&lt;/span&gt;Drag &amp; Drop exam&lt;/h2&gt;  
                      &lt;img class="img-responsive" id="myImg" src="img/Link Students.png" alt="Trolltunga, Norway" &gt;
                      &lt;div id="myModal" class="modal"&gt;
                      &lt;!-- The Close Button --&gt;
                      &lt;span class="close" onclick="document.getElementById('myModal').style.display='none'"&gt;&amp;times;&lt;/span&gt;
                      &lt;!-- Modal Content (The Image) --&gt;
                      &lt;img class="modal-content" id="img01"&gt;
                      &lt;!-- Modal Caption (Image Text) --&gt;
                      &lt;div id="caption"&gt;&lt;/div&gt;
                      &lt;/div&gt;
                      &lt;p class="feature-content-description"&gt;Capture an exam quickly by using the Drag &amp; Drop functionality. The user would drag the exam and drop it in the 
                      upload section. The exam will get displayed and it will keep it's original formatting.&lt;/p&gt;  
                                  &lt;br&gt;
                                  &lt;/div&gt;
                              &lt;/div&gt;
                              &lt;div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 col-xxs-12"&gt;
                      &lt;div class="testimonial-content"&gt;
                      &lt;h2 style="color:#37cdff" class="feature-content-title blue-text"&gt;&lt;span class="blue"&gt;1&lt;/span&gt;Drag &amp; Drop exam&lt;/h2&gt;  
                      &lt;img class="img-responsive" id="myImg" src="img/Link Students.png" alt="Trolltunga, Norway" &gt;
                      &lt;div id="myModal" class="modal"&gt;
                      &lt;!-- The Close Button --&gt;
                      &lt;span class="close" onclick="document.getElementById('myModal').style.display='none'"&gt;&amp;times;&lt;/span&gt;
                      &lt;!-- Modal Content (The Image) --&gt;
                      &lt;img class="modal-content" id="img01"&gt;
                      &lt;!-- Modal Caption (Image Text) --&gt;
                      &lt;div id="caption"&gt;&lt;/div&gt;
                      &lt;/div&gt;
                      &lt;p class="feature-content-description"&gt;Capture an exam quickly by using the Drag &amp; Drop functionality. The user would drag the exam and drop it in the 
                      upload section. The exam will get displayed and it will keep it's original formatting.&lt;/p&gt;  
                                  &lt;br&gt;
                                  &lt;/div&gt;
                              &lt;/div&gt;
  
  
  
  
                          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/section&gt;
  </code></pre>
  
  <p>CSS</p>
  
  <pre><code>#myImg {
      border-radius: 5px;
      cursor: pointer;
      transition: 0.3s;
  }
  
  #myImg:hover {opacity: 0.7;}
  
  /* The Modal (background) */
  .modal {
      display: none; /* Hidden by default */
      position: fixed; /* Stay in place */
      z-index: 1; /* Sit on top */
      padding-top: 100px; /* Location of the box */
      left: 0;
      top: 0;
      width: 100%; /* Full width */
      height: 100%; /* Full height */
      overflow: auto; /* Enable scroll if needed */
      background-color: rgb(0,0,0); /* Fallback color */
      background-color: rgba(0,0,0,0.9); /* Black w/ opacity */
  }
  
  /* Modal Content (Image) */
  .modal-content {
      margin: auto;
      display: block;
      width: 80%;
      max-width: 1000px;
  }
  
  /* Caption of Modal Image (Image Text) - Same Width as the Image */
  #caption {
      margin: auto;
      display: block;
      width: 80%;
      max-width: 700px;
      text-align: center;
      color: #ccc;
      padding: 10px 0;
      height: 150px;
  }
  </code></pre>
  
  <p>JS</p>
  
  <pre><code>&lt;script&gt;
  var modal = document.getElementById('myModal');
  
  // Get the image and insert it inside the modal - use its "alt" text as a caption
  var img = document.getElementById('myImg');
  var modalImg = document.getElementById("img01");
  var captionText = document.getElementById("caption");
  img.onclick = function(){
      modal.style.display = "block";
      modalImg.src = this.src;
      captionText.innerHTML = this.alt;
  }
  
  // Get the &lt;span&gt; element that closes the modal
  var span = document.getElementsByClassName("close")[0];
  
  // When the user clicks on &lt;span&gt; (x), close the modal
  span.onclick = function() { 
    modal.style.display = "none";
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>Please assists. Thank you</p>