title: how to define setInterval in loop?
body: <p>I have sample code like this</p>
  
  <pre><code>        &lt;input type="button" value="test" onclick="newfunc()"/&gt;
          &lt;br/&gt;
          &lt;div class="first"&gt;
              &lt;input type="text" id="iid88" /&gt;
              &lt;br /&gt;
          &lt;/div&gt;
      &lt;script&gt;
  function newfunc() {
      var one = document.getElementsByClassName('first')[0].querySelectorAll("[id^=iid]");
              for (var i = 0; i &lt; one.length; i++)
              {
              setInterval(function () {
              one[i].value = 20;
              }, 1000);
              }
  }
      &lt;/script&gt;
  </code></pre>
  
  <p>i cannot get answer within input text box .
  how can i resolve this problem ?</p>
  
  <p>i see this page <a href="https://stackoverflow.com/questions/750486/javascript-closure-inside-loops-simple-practical-example">JavaScript closure inside loops – simple practical example</a> but here we dont have any setInterval usage in answers</p>