title: js loop work in console, but not update in dom
body: <p>Why does this loop not work?</p>
  
  <pre><code>function progress_metro(from, to)
  {
      console.log(from+" "+to);
      for(var i = from; i &lt;= to; i++)
      {
          console.log("asdasdasd - "+i+" "+from+" "+to);
          setTimeout(function() {$(".percentage").text(i+"%")},i+100);
      }
  }
  </code></pre>
  
  <p>Console log is </p>
  
  <pre><code>asdasdasd - 26 26 50 viewCountry.php?country=albania:110
  asdasdasd - 27 26 50 viewCountry.php?country=albania:110
  asdasdasd - 28 26 50 viewCountry.php?country=albania:110
  asdasdasd - 29 26 50 viewCountry.php?country=albania:110
  asdasdasd - 30 26 50 viewCountry.php?country=albania:110
  asdasdasd - 31 26 50 viewCountry.php?country=albania:110
  asdasdasd - 32 26 50 viewCountry.php?country=albania:110
  asdasdasd - 33 26 50 viewCountry.php?country=albania:110
  asdasdasd - 34 26 50 viewCountry.php?country=albania:110
  asdasdasd - 35 26 50 viewCountry.php?country=albania:110
  asdasdasd - 36 26 50 viewCountry.php?country=albania:110
  asdasdasd - 37 26 50 viewCountry.php?country=albania:110
  asdasdasd - 38 26 50 viewCountry.php?country=albania:110
  asdasdasd - 39 26 50 viewCountry.php?country=albania:110
  asdasdasd - 40 26 50 viewCountry.php?country=albania:110
  asdasdasd - 41 26 50 viewCountry.php?country=albania:110
  asdasdasd - 42 26 50 viewCountry.php?country=albania:110
  asdasdasd - 43 26 50 viewCountry.php?country=albania:110
  asdasdasd - 44 26 50 viewCountry.php?country=albania:110
  asdasdasd - 45 26 50 viewCountry.php?country=albania:110
  asdasdasd - 46 26 50 viewCountry.php?country=albania:110
  asdasdasd - 47 26 50 viewCountry.php?country=albania:110
  asdasdasd - 48 26 50 
  </code></pre>
  
  <p>Thanks!</p>
  
  <p>P.S. Thanks you all, guys! I love this comunity!
  <a href="http://jslinterrors.com/dont-make-functions-within-a-loop/" rel="nofollow">Problem</a>
  jsfiddle - good thing, thanks for share</p>