title: how to dynamically generate input fields based on user input in javascript
body: <p>I'm creating a course registration form that requires user entering any desired number of candidates that will be taking the course from his or her company.</p>
  
  <p>Example:
  If a user enters 3 into the field named "No of Candidates", the script should generate 3 rows with fields like "Name", "Email", "Phone", "Sex" and "Position" for each candidate's information.</p>
  
  <p>Pls Find below the html for the "No of Candidate" field and Fields to be generated for user to enter each Candidate's information.</p>
  
  <p>Pls Note: Fields to be generated is based on user's input. i.e it can be 3, 5, 10 e.t.c</p>
  
  <pre><code>&lt;p&gt;
  &lt;label&gt;&lt;strong&gt;No of Candidates&lt;/strong&gt;&lt;/label&gt;
  &lt;label&gt;&lt;input name="cand_no" type="text" placeholder="Type Your Number of Candidates" onchange='this.form.submit()' /&gt;&lt;/label&gt;
    &lt;div class="clear"&gt;&lt;/div&gt;
  &lt;/p&gt;
  
  
  
      &lt;div class="cand_fields"&gt;
      &lt;table width="630" border="0"&gt;
        &lt;tr&gt;
          &lt;td&gt;Name&lt;/td&gt;
          &lt;td width="20"&gt;Sex&lt;/td&gt;
          &lt;td&gt;Email&lt;/td&gt;
          &lt;td&gt;Phone&lt;/td&gt;
          &lt;td width="40"&gt;Position&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;&lt;input name="cand_name" type="text" placeholder="Name" required="required" /&gt;&lt;/td&gt;
          &lt;td&gt;
          &lt;select name="cand_sex" required="required"&gt;
          &lt;option value=" "&gt; &lt;/option&gt;
          &lt;option value="Male"&gt;Male&lt;/option&gt;    
          &lt;option value="Female"&gt;Female&lt;/option&gt;
          &lt;/select&gt;
          &lt;/td&gt;
          &lt;td&gt;&lt;input name="cand_email" type="text" placeholder="Email" required="required" /&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input name="cand_phone" type="text" placeholder="Phone" required="required" /&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input name="cand_pos" type="text" placeholder="Position" required="required" /&gt;&lt;/td&gt;
        &lt;/tr&gt;
      &lt;/table&gt;&lt;/div&gt;
  </code></pre>
  
  <p>I've tried this with php but it isn't pleasant doing this from the server side. So, I really need it to be done from the client side using javascript. </p>
  
  <p>I'll be very grateful if this can be achieved with javascript...</p>
  
  <p>Thanks a million!</p>