title: give dynamically generated textboxes unique names
body: <p>I've created a script to dynamically generate X textboxes based on user input. How can I give each textbox their own name so I can use each one individually after they are generated?</p>
  
  <p>Demo: <a href="http://jsfiddle.net/Zsmkn/3/" rel="nofollow">Fiddle</a></p>
  
  <pre><code>&lt;html&gt;
  
  &lt;head&gt;
  &lt;script src="http://code.jquery.com/jquery-1.9.1.js"&gt;&lt;/script&gt;
  &lt;script src="http://code.jquery.com/ui/1.10.1/jquery-ui.js"&gt;&lt;/script&gt;
  &lt;script&gt;
  
  $(document).ready(function(){
  $("#ppl").change(function(){
  
      // The easiest way is of course to delete all textboxes before adding new ones
      //$("#holder").html("");
  
      var count = $("#holder input").size();
      var requested = parseInt($("#ppl").val(),10);
  
      if (requested &gt; count) {
          for(i=count; i&lt;requested; i++) {
          var $ctrl = $('&lt;input/&gt;').attr({ type: 'text', name:'text', value:'text'});        
              $("#holder").append($ctrl);
          }
  }
      else if (requested &lt; count) {
          var x = requested - 1;
          $("#holder input:gt(" + x + ")").remove();
      }
  });
  });
  &lt;/script&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
      &lt;Input type="text" id="ppl"&gt;
       &lt;button onclick="function()"&gt;Try it&lt;/button&gt;       
  &lt;div id="holder"&gt;&lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  
  $(document).ready(function(){
      $("#ppl").change(function(){
  
          var count = $("#holder input").size();
          var requested = parseInt($("#ppl").val(),10);
  
          if (requested &gt; count) {
              for(i=count; i&lt;requested; i++) {
                  var $ctrl = $('&lt;input/&gt;').attr({ type: 'text', name:'text', value:'text'});        
                  $("#holder").append($ctrl);
              }
          } else if (requested &lt; count) {
              var x = requested - 1;
              $("#holder input:gt(" + x + ")").remove();
          }
      });
  });
  </code></pre>
  
  <p>im plan to use the generated textboxes to request more information from user and then use that new information to process another script.</p>