title: create a new text field when click on previous text field
body: <p>I want to create a new text field while clicking on an already created text field.
  I have written the function which is working but the problem is, it should only create a new text field when clicking on the last one, for example if there are three text fields and clicking on first two will not add a new text field. Only the clicking on third text field can create a new. with the following code it is not working properly (its a Java script function):</p>
  
  <pre><code>    var FieldCount=1;
      function addInputField(count)  //on add input button click
      {           
  
          alert(FieldCount);
          alert(count);
           if(FieldCount == count) 
          {
  
              FieldCount++; 
  
  
              var field = "#textfield_"+count;
  
              $node = '&lt;input id="textfield_'+FieldCount+'" type="text" name="textfield"    onClick="addInputField(FieldCount);" /&gt;';
              $(field).after($node);
  
          }
  
      };
  </code></pre>
  
  <p>There is just one text field in the begging when page loads that is:</p>
  
  <pre><code>    &lt;input id="textfield_1" type="text" name="textfield" onClick="addInputField(FieldCount);" /&gt;
  </code></pre>