I'm trying to make a 30 second countdown on a span element (#thirty) that will be started on click of another element (#start). It doesn't seem to work. I would appreciate your help.
var countdown = function() {
  setTimeout(function() {
    var i = 30;
    do {
      $("#thirty").text(i);
      i--;
    } while (i > 0);
  }, 1000);
}
$("#start-timer").click(countdown());
 
    