title: Make a countdown timer display a modal window bootstrap
body: <p>I have another issue. This time I want to make that when a countdown timer reaches 0 it triggers or display a modal window to show up. </p>
  
  <p>I have both the codes for the modal and the countdown timer, but I dunno how exactly make it so it calls for the modal. </p>
  
  <p>I've tried several suggestions I've read but none works or it just screws the code.</p>
  
  <p>Many thanks in advance.</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>var seconds = 300; //**change 120 for any number you want, it's the seconds **//
  function secondPassed() {
      var minutes = Math.round((seconds - 30)/60);
      var remainingSeconds = seconds % 60;
      if (remainingSeconds &lt; 10) {
          remainingSeconds = "0" + remainingSeconds;  
      }
      document.getElementById('countdown').innerHTML = minutes + ":" + remainingSeconds;
      if (seconds == 0) {
          clearInterval(countdownTimer);
          document.getElementById('countdown').innerHTML = "Last chance!";
      } else {
          seconds--;
      }
  }
   
  var countdownTimer = setInterval('secondPassed()', 1000);</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!-- Modal start--&gt;
  &lt;div class="modal fade" id="ventanamdl" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"&gt;
          &lt;div class="modal-dialog modal-lg"&gt;
            &lt;div class="modal-content"&gt; &lt;!-- to create more modals copy-paste from the div class "modal fade" until here, you can customize moda-content with css--&gt;
              &lt;div class="modal-header"&gt;
                &lt;h1&gt;This is your last chance!&lt;/h1&gt;
                &lt;button type="button" class="close" data-dismiss="modal" aria-hidden="true"&gt;&amp;times;&lt;/button&gt;
              &lt;/div&gt;
              &lt;div class="modal-body"&gt;
                          
              &lt;p&gt;Your spot can't be reserved any longer! Click the button to join now!
              &lt;br&gt;
              &lt;button id="btnjoin" type="submit" onclick="location.href='http://google.com';"&gt;Join!&lt;/button&gt;
              &lt;/p&gt;   
                
              &lt;/div&gt;
              &lt;div class="modal-footer"&gt;
              This is your last chance!
              &lt;/div&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
  &lt;!-- Modal end--&gt;
      
  
  &lt;div id="bottomdiv"&gt;
    &lt;p class="mytext2"&gt;Over 87 people have claimed their spot. Get yours before time runs out! &lt;span id="countdown" class="timer"&gt;&lt;/span&gt;&lt;/p&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>