title: Javascript countdown timer to each html span
body: <p>I have programmatically created <code>&lt;span&gt;</code> tag in my html</p>
  
  <p>I found simple example of javascript to do countdown timer</p>
  
  <pre><code>// set the date we're counting down to
  var target_date = new Date("Aug 15, 2019").getTime();
  
  // variables for time units
  var days, hours, minutes, seconds;
  
  // get tag element
  var countdown = document.getElementById("countdown");
  
  // update the tag with id "countdown" every 1 second
  setInterval(function () {
  
      // find the amount of "seconds" between now and target
      var current_date = new Date().getTime();
      var seconds_left = (target_date - current_date) / 1000;
  
      // do some time calculations
      days = parseInt(seconds_left / 86400);
      seconds_left = seconds_left % 86400;
  
      hours = parseInt(seconds_left / 3600);
      seconds_left = seconds_left % 3600;
  
      minutes = parseInt(seconds_left / 60);
      seconds = parseInt(seconds_left % 60);
  
      // format countdown string + set tag value
      countdown.innerHTML = days + "d, " + hours + "h, "
      + minutes + "m, " + seconds + "s";  
  
  }, 1000);
  </code></pre>
  
  <p>But this example let me use only one element</p>
  
  <p>But i need to use this code like</p>
  
  <pre><code>&lt;span onload="this.countdown(300)"&gt;&lt;/span&gt;
  </code></pre>
  
  <p>So 300 is seconds which dynamically changing by my script</p>
  
  <p>So after my script work i get on page</p>
  
  <pre><code> &lt;span onload="this.countdown(150)"&gt;&lt;/span&gt;
   &lt;span onload="this.countdown(3000)"&gt;&lt;/span&gt;
   &lt;span onload="this.countdown(4500)"&gt;&lt;/span&gt;
   &lt;span onload="this.countdown(600)"&gt;&lt;/span&gt;
   &lt;span onload="this.countdown(390)"&gt;&lt;/span&gt;
  </code></pre>
  
  <p>So i need run all this timer at once, how to do that?</p>