title: Is it possible to dynamically add 2 rows at once?
body: <p><img src="https://i.stack.imgur.com/vKHqW.jpg" alt="enter image description here"></p>
  
  <p>I have  2 rows on our form that must be repeated 4 different times.</p>
  
  <p>So, rather than show 8 rows, at same time, is it possible to show first 2 rows with a button that says, "Add additional rows"</p>
  
  <p>If a user clicks the button, 2 rows are automatically added.</p>
  
  <p>From the code below, each code beginning with ...and ends with  displays 4 times.</p>
  
  <p>The 2 rows display 8 times combined</p>
  
  <p>The rows don't always get filled. So, it will be nice to have the users click a button to add additional 2 rows if needed.</p>
  
  <p>I have a js that can add one row but I can't get it to add 2 at same time.</p>
  
  <p>Here is how the code with ... I am trying to add automatically looks like.</p>
  
  <pre><code>&lt;script type='text/javascript'&gt;//&lt;![CDATA[
      $(window).load(function () {
          var index = 1;
          $(document).ready(function () {
              $("#more").click(function () {
                  addRow(1)
                  //alert($("#form1").html()); Uncomment to view updated form html
              });
          });
  
  
          function addRow(rowCount) {
              for (i = 0; i &lt; rowCount; i++) {
                  index = index + 1;
                  $("#form1").append($("#template").html().replace(/_1/g, "_" + index));
              }
          }
  
      });//]]&gt;  
  
  &lt;/script&gt;
  
        &lt;div id="template"&gt;
                    &lt;table border="1" bordercolor="black" cellspacing="0"&gt;
              &lt;tr&gt;
              &lt;td&gt;
  
        &lt;table style="border-top-width:2px;border-top-style:solid;border-top-color:#000000"&gt;
              &lt;tr valign="top"&gt;
                   &lt;td valign="middle" style="font-size:large;font-weight:bold;" class="style4"&gt;&lt;/td&gt;
                  &lt;td style="width:105px;border-right-width:2px;border-right-style:solid;border-right-color:#000000"&gt;
                      Line #&lt;br /&gt;
                      &lt;asp:TextBox ID="TextBox24" runat="server" Width="25px" /&gt;
                  &lt;/td&gt;
                  &lt;td style="width:135px;border-right-width:2px;border-right-style:solid;border-right-color:#000000"&gt;
                     Code&lt;br /&gt;
                       &lt;asp:TextBox ID="TextBox38" runat="server" Width="25px" /&gt;
                  &lt;/td&gt;
                   &lt;td style="width:125px;border-right-width:2px;border-right-style:solid;border-right-color:#000000"&gt;
                      Document Reference&lt;br /&gt;
                      &lt;asp:TextBox ID="TextBox25" runat="server" Width="45px" /&gt;
                  &lt;/td&gt;
                   &lt;td style="width:105px;border-right-width:2px;border-right-style:solid;border-right-color:#000000"&gt;
                      Line&lt;br /&gt;
                      &lt;asp:TextBox ID="TextBox26" runat="server" Width="25px" /&gt;
                  &lt;/td&gt;
                   &lt;td style="width:115px;border-right-width:2px;border-right-style:solid;border-right-color:#000000"&gt;
                      PC COMM LN&lt;br /&gt;
                      &lt;asp:TextBox ID="TextBox27" runat="server" Width="25px" /&gt;
                  &lt;/td&gt;
                   &lt;td style="width:115px;border-right-width:2px;border-right-style:solid;border-right-color:#000000"&gt;
                      Vendor Invoice #&lt;br /&gt;
                      &lt;asp:TextBox ID="TextBox28" runat="server" Width="85px" /&gt;
                  &lt;/td&gt;
                   &lt;td style="width:105px;border-right-width:2px;border-right-style:solid;border-right-color:#000000"&gt;
                    Fund&lt;br /&gt;
                        &lt;asp:DropDownList id="txtfund" runat="server"&gt;&lt;/asp:DropDownList&gt;
                  &lt;/td&gt;
                   &lt;td style="width:105px;border-right-width:2px;border-right-style:solid;border-right-color:#000000"&gt;
                      Agency&lt;br /&gt;
                        &lt;asp:DropDownList id="txtagency" runat="server"&gt;&lt;/asp:DropDownList&gt;
                  &lt;/td&gt;
                   &lt;td style="width:105px;border-right-width:2px;border-right-style:solid;border-right-color:#000000"&gt;
                      Org.&lt;br /&gt;
                       &lt;asp:DropDownList id="txtorg" runat="server"&gt;&lt;/asp:DropDownList&gt;
                  &lt;/td&gt;
                   &lt;td style="width:105px;border-right-width:2px;border-right-style:solid;border-right-color:#000000"&gt;
                      Sub&lt;br /&gt;
                      &lt;asp:TextBox ID="TextBox32" runat="server" Width="25px" /&gt;
                  &lt;/td&gt;
                   &lt;td style="width:105px;border-right-width:2px;border-right-style:solid;border-right-color:#000000"&gt;
                      Activity&lt;br /&gt;
                      &lt;asp:TextBox ID="TextBox33" runat="server" Width="25px" /&gt;
                  &lt;/td&gt;
                   &lt;td style="width:105px;border-right-width:2px;border-right-style:solid;border-right-color:#000000"&gt;
                      Object&lt;br /&gt;
                      &lt;asp:TextBox ID="TextBox34" runat="server" Width="25px" /&gt;
                  &lt;/td&gt;
                   &lt;td style="width:115px;border-right-width:2px;border-right-style:solid;border-right-color:#000000"&gt;
                      Sub&lt;br /&gt;
                      &lt;asp:TextBox ID="TextBox35" runat="server" Width="25px" /&gt;
                  &lt;/td&gt;
                   &lt;td style="width:115px;border-right-width:2px;border-right-style:solid;border-right-color:#000000"&gt;
                     Rev Source&lt;br /&gt;
                      &lt;asp:TextBox ID="TextBox36" runat="server" Width="25px" /&gt;
                  &lt;/td&gt;
                   &lt;td style="width:105px;"&gt;
                      Sub&lt;br /&gt;
                      &lt;asp:TextBox ID="TextBox37" runat="server" Width="25px" /&gt;
                  &lt;/td&gt;
              &lt;/tr&gt;
          &lt;/table&gt;   
  
          &lt;table style="border-top-width:2px;border-top-style:solid;border-top-color:#000000"&gt;
              &lt;tr valign="top"&gt;
                   &lt;td valign="middle" style="font-size:large;font-weight:bold;" class="style4"&gt;&lt;/td&gt;
                  &lt;td style="width:105px;border-right-width:2px;border-right-style:solid;border-right-color:#000000"&gt;
                      &lt;br /&gt;&lt;br /&gt;Job #&lt;br /&gt;
                      &lt;asp:TextBox ID="TextBox39" runat="server" Width="45px" /&gt;
                  &lt;/td&gt;
                  &lt;td style="width:135px;border-right-width:2px;border-right-style:solid;border-right-color:#000000"&gt;
                      &lt;br /&gt;
                      Rept&lt;br /&gt;Category&lt;br /&gt;
                       &lt;asp:TextBox ID="TextBox40" runat="server" Width="25px" /&gt;
                  &lt;/td&gt;
                   &lt;td style="width:105px;border-right-width:2px;border-right-style:solid;border-right-color:#000000"&gt;
                      &lt;br /&gt;&lt;br /&gt;BS Acct&lt;br /&gt;
                      &lt;asp:TextBox ID="TextBox41" runat="server" Width="25px" /&gt;
                  &lt;/td&gt;
                   &lt;td style="width:105px;border-right-width:2px;border-right-style:solid;border-right-color:#000000"&gt;
                     &lt;br /&gt;&lt;br /&gt; DISC&lt;br /&gt;
                      &lt;asp:TextBox ID="TextBox42" runat="server" Width="25px" /&gt;
                  &lt;/td&gt;
                   &lt;td style="width:105px;border-right-width:2px;border-right-style:solid;border-right-color:#000000"&gt;
                      &lt;br /&gt;Description (30) Spaces&lt;br /&gt;
                      &lt;asp:TextBox ID="TextBox403" runat="server" onKeyUp="javascript:Count(this,30);" onChange="javascript:Count(this,30);" TextMode="MultiLine" Columns="30" Rows="2" /&gt;
                  &lt;/td&gt;
                   &lt;td style="width:105px;border-right-width:2px;border-right-style:solid;border-right-color:#000000"&gt;
                      &lt;br /&gt;&lt;br /&gt;Quant.&lt;br /&gt;
                      &lt;asp:TextBox ID="TextBox44" runat="server" Width="25px" /&gt;
                  &lt;/td&gt;
                   &lt;td style="width:105px;border-right-width:2px;border-right-style:solid;border-right-color:#000000"&gt;
                     &lt;br /&gt;&lt;br /&gt; Amount&lt;br /&gt;
                      &lt;asp:TextBox ID="TextBox45" runat="server" Width="55px" /&gt;
                  &lt;/td&gt;
                   &lt;td style="width:105px;border-right-width:2px;border-right-style:solid;border-right-color:#000000"&gt;
                     Inc&lt;br /&gt;/&lt;br /&gt;Dec&lt;br /&gt;
                      &lt;asp:TextBox ID="TextBox46" runat="server" Width="25px" /&gt;
                  &lt;/td&gt;
                   &lt;td style="width:105px;"&gt;
  
                      P&lt;br /&gt;/&lt;br /&gt;F&lt;br /&gt;
                      &lt;asp:TextBox ID="TextBox47" runat="server" Width="25px" /&gt;
                  &lt;/td&gt;
              &lt;/tr&gt;
          &lt;/table&gt;   
          &lt;/td&gt;
          &lt;/tr&gt;
          &lt;/table&gt;        
          &lt;/div&gt;
  
        &lt;a href="#" id="more"&gt;Add More Rows&lt;/a&gt;
       &lt;div class="noprint" style="border-top-width:2px;border-top-style:solid;border-top-color:#000000""&gt;
              &lt;asp:Button runat="server" ID="btnSAP" Text="Save" OnClientClick=" return validate()" /&gt;
               &lt;asp:Button ID="btnClear" OnClick="ClearFilter" height="27px" Text="Reset" runat="server" class="btn" /&gt; 
              &lt;asp:Button runat="server" ID="btnCancel" Text="Exit Form" /&gt;
               &lt;!-- Results --&gt;
              &lt;asp:Label ID="lblResult" style ="font-weight:bold; font-size:large" runat="server"&gt;&lt;/asp:Label&gt;
        &lt;/div&gt;
     &lt;/form&gt;
  </code></pre>
  
  <p>Here is a link to fiddle created by Mohammed(thanks)</p>
  
  <p><a href="http://jsfiddle.net/TE6ac/" rel="nofollow noreferrer">http://jsfiddle.net/TE6ac/</a></p>
  
  <p>I also found this example:</p>
  
  <p><a href="http://jsfiddle.net/nick_craver/BE5Lr/" rel="nofollow noreferrer">http://jsfiddle.net/nick_craver/BE5Lr/</a></p>
  
  <p>If I duplicate the ...</p>
  
  <p>I am close to what I am looking for. Problem is I have many more .. and wouldn't know where to start and stop.</p>