title: function inside while loop
body: <p>What Im trying to do is to get the content of a specific textarea tag in a specific clicks of a button, so I think a loop will solve this problem. The while loop on PHP does the role of making the name of textarea different and button's onclick trigger. But the loop in javascript wont work. Please anyone help what is the right one to complete my task?? Sorry for bad english...Thanks in advance</p>
  
  <pre><code>    &lt;html&gt;
      &lt;head&gt;
      &lt;script&gt;
  
      var i = 0;
  
      while(i &lt; 2000)
      {
          i++;
  
          function feedbacks+i()
          {
           var feed = document.getElementsByName("feedback"+i)[0].value;
           alert(feed);
          }
      }
  
      &lt;/script&gt;
      &lt;/head&gt;
  
      &lt;body&gt;
  
      &lt;?php
  
      while($i &lt; 2000)
  
      $i++;
      echo "&lt;textarea name='feedback$i' &gt;you post&lt;/textarea&gt;";
      echo "&lt;button onclick='feedbacks$i()' &gt;send feedback&lt;/button&gt;";
  
      ?&gt;
  
      &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>