title: Dynamically creating multiple textboxes depending on minimum number of characters in previous textbox/ javascript/asp
body: <p>Hi I have a webform in which i need to add multiple textboxes dynamically depending on the entry in previous textbox.. Even if one character is entered in the previous textbox it should generate new texbox beside it without losing the focus from previous textbox and it should allow me to enter as many characters without limiting..
  Here is my code :</p>
  
  <p></p>
  
  <pre><code>    getId = function ()
       {
          var id = 1;
          return function () 
          {
              id++;
          }
      }
  
      function CreateTextbox()
       {
          var box = document.getElementById("divCreateTextbox");
          var curr = 'txt' + getId();
          var inp = document.createElement('input');
  
          inp.type = 'text';
          inp.name = 'textfield';
          inp.setAttribute("id", curr);
          inp.setAttribute("minlength",'1');
          box.appendChild(inp);
          inp.setAttribute('onkeyup', 'moveOnMin(this)');
          inp.focus();
  
      }
  
      function moveOnMin(s)
       {
        if(s.value.length &gt;= parseInt(s.getAttribute("minlength")))
        {
  
           CreateTextbox();
        }
  </code></pre>
  
  <p>The problem with the above code is, it is just allowing me to enter 1 character in one textbox and shifts the focus on new textbox. Everytime I try to enter more than one character in the textbox it creates new textboxes for each character. Any solutions ??</p>