Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8000367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:46:16+00:00 2026-06-04T15:46:16+00:00

I have 2 rows on our form that must be repeated 4 different times.

  • 0

enter image description here

I have 2 rows on our form that must be repeated 4 different times.

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”

If a user clicks the button, 2 rows are automatically added.

From the code below, each code beginning with …and ends with displays 4 times.

The 2 rows display 8 times combined

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.

I have a js that can add one row but I can’t get it to add 2 at same time.

Here is how the code with … I am trying to add automatically looks like.

<script type='text/javascript'>//<![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 < rowCount; i++) {
                index = index + 1;
                $("#form1").append($("#template").html().replace(/_1/g, "_" + index));
            }
        }

    });//]]>  

</script>

      <div id="template">
                  <table border="1" bordercolor="black" cellspacing="0">
            <tr>
            <td>

      <table style="border-top-width:2px;border-top-style:solid;border-top-color:#000000">
            <tr valign="top">
                 <td valign="middle" style="font-size:large;font-weight:bold;" class="style4"></td>
                <td style="width:105px;border-right-width:2px;border-right-style:solid;border-right-color:#000000">
                    Line #<br />
                    <asp:TextBox ID="TextBox24" runat="server" Width="25px" />
                </td>
                <td style="width:135px;border-right-width:2px;border-right-style:solid;border-right-color:#000000">
                   Code<br />
                     <asp:TextBox ID="TextBox38" runat="server" Width="25px" />
                </td>
                 <td style="width:125px;border-right-width:2px;border-right-style:solid;border-right-color:#000000">
                    Document Reference<br />
                    <asp:TextBox ID="TextBox25" runat="server" Width="45px" />
                </td>
                 <td style="width:105px;border-right-width:2px;border-right-style:solid;border-right-color:#000000">
                    Line<br />
                    <asp:TextBox ID="TextBox26" runat="server" Width="25px" />
                </td>
                 <td style="width:115px;border-right-width:2px;border-right-style:solid;border-right-color:#000000">
                    PC COMM LN<br />
                    <asp:TextBox ID="TextBox27" runat="server" Width="25px" />
                </td>
                 <td style="width:115px;border-right-width:2px;border-right-style:solid;border-right-color:#000000">
                    Vendor Invoice #<br />
                    <asp:TextBox ID="TextBox28" runat="server" Width="85px" />
                </td>
                 <td style="width:105px;border-right-width:2px;border-right-style:solid;border-right-color:#000000">
                  Fund<br />
                      <asp:DropDownList id="txtfund" runat="server"></asp:DropDownList>
                </td>
                 <td style="width:105px;border-right-width:2px;border-right-style:solid;border-right-color:#000000">
                    Agency<br />
                      <asp:DropDownList id="txtagency" runat="server"></asp:DropDownList>
                </td>
                 <td style="width:105px;border-right-width:2px;border-right-style:solid;border-right-color:#000000">
                    Org.<br />
                     <asp:DropDownList id="txtorg" runat="server"></asp:DropDownList>
                </td>
                 <td style="width:105px;border-right-width:2px;border-right-style:solid;border-right-color:#000000">
                    Sub<br />
                    <asp:TextBox ID="TextBox32" runat="server" Width="25px" />
                </td>
                 <td style="width:105px;border-right-width:2px;border-right-style:solid;border-right-color:#000000">
                    Activity<br />
                    <asp:TextBox ID="TextBox33" runat="server" Width="25px" />
                </td>
                 <td style="width:105px;border-right-width:2px;border-right-style:solid;border-right-color:#000000">
                    Object<br />
                    <asp:TextBox ID="TextBox34" runat="server" Width="25px" />
                </td>
                 <td style="width:115px;border-right-width:2px;border-right-style:solid;border-right-color:#000000">
                    Sub<br />
                    <asp:TextBox ID="TextBox35" runat="server" Width="25px" />
                </td>
                 <td style="width:115px;border-right-width:2px;border-right-style:solid;border-right-color:#000000">
                   Rev Source<br />
                    <asp:TextBox ID="TextBox36" runat="server" Width="25px" />
                </td>
                 <td style="width:105px;">
                    Sub<br />
                    <asp:TextBox ID="TextBox37" runat="server" Width="25px" />
                </td>
            </tr>
        </table>   

        <table style="border-top-width:2px;border-top-style:solid;border-top-color:#000000">
            <tr valign="top">
                 <td valign="middle" style="font-size:large;font-weight:bold;" class="style4"></td>
                <td style="width:105px;border-right-width:2px;border-right-style:solid;border-right-color:#000000">
                    <br /><br />Job #<br />
                    <asp:TextBox ID="TextBox39" runat="server" Width="45px" />
                </td>
                <td style="width:135px;border-right-width:2px;border-right-style:solid;border-right-color:#000000">
                    <br />
                    Rept<br />Category<br />
                     <asp:TextBox ID="TextBox40" runat="server" Width="25px" />
                </td>
                 <td style="width:105px;border-right-width:2px;border-right-style:solid;border-right-color:#000000">
                    <br /><br />BS Acct<br />
                    <asp:TextBox ID="TextBox41" runat="server" Width="25px" />
                </td>
                 <td style="width:105px;border-right-width:2px;border-right-style:solid;border-right-color:#000000">
                   <br /><br /> DISC<br />
                    <asp:TextBox ID="TextBox42" runat="server" Width="25px" />
                </td>
                 <td style="width:105px;border-right-width:2px;border-right-style:solid;border-right-color:#000000">
                    <br />Description (30) Spaces<br />
                    <asp:TextBox ID="TextBox403" runat="server" onKeyUp="javascript:Count(this,30);" onChange="javascript:Count(this,30);" TextMode="MultiLine" Columns="30" Rows="2" />
                </td>
                 <td style="width:105px;border-right-width:2px;border-right-style:solid;border-right-color:#000000">
                    <br /><br />Quant.<br />
                    <asp:TextBox ID="TextBox44" runat="server" Width="25px" />
                </td>
                 <td style="width:105px;border-right-width:2px;border-right-style:solid;border-right-color:#000000">
                   <br /><br /> Amount<br />
                    <asp:TextBox ID="TextBox45" runat="server" Width="55px" />
                </td>
                 <td style="width:105px;border-right-width:2px;border-right-style:solid;border-right-color:#000000">
                   Inc<br />/<br />Dec<br />
                    <asp:TextBox ID="TextBox46" runat="server" Width="25px" />
                </td>
                 <td style="width:105px;">

                    P<br />/<br />F<br />
                    <asp:TextBox ID="TextBox47" runat="server" Width="25px" />
                </td>
            </tr>
        </table>   
        </td>
        </tr>
        </table>        
        </div>

      <a href="#" id="more">Add More Rows</a>
     <div class="noprint" style="border-top-width:2px;border-top-style:solid;border-top-color:#000000"">
            <asp:Button runat="server" ID="btnSAP" Text="Save" OnClientClick=" return validate()" />
             <asp:Button ID="btnClear" OnClick="ClearFilter" height="27px" Text="Reset" runat="server" class="btn" /> 
            <asp:Button runat="server" ID="btnCancel" Text="Exit Form" />
             <!-- Results -->
            <asp:Label ID="lblResult" style ="font-weight:bold; font-size:large" runat="server"></asp:Label>
      </div>
   </form>

Here is a link to fiddle created by Mohammed(thanks)

http://jsfiddle.net/TE6ac/

I also found this example:

http://jsfiddle.net/nick_craver/BE5Lr/

If I duplicate the …

I am close to what I am looking for. Problem is I have many more .. and wouldn’t know where to start and stop.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T15:46:18+00:00Added an answer on June 4, 2026 at 3:46 pm

    Take a look at this fiddle here:
    http://jsfiddle.net/dharmavir/9nHbs/
    it should help.!

    <div id="template">
                      <table border="1" bordercolor="black" cellspacing="0">
                <tr>
                <td>
    
          <table style="border-top-width:2px;border-top-style:solid;border-top-color:#000000">
                <tr valign="top">
                     <td valign="middle" style="font-size:large;font-weight:bold;" class="style4"></td>
                    <td style="width:105px;border-right-width:2px;border-right-style:solid;border-right-color:#000000">
                        Line #<br />
                        <asp:TextBox ID="TextBox24" runat="server" Width="25px" />
                    </td>
                    <td style="width:135px;border-right-width:2px;border-right-style:solid;border-right-color:#000000">
                       Code<br />
                         <asp:TextBox ID="TextBox38" runat="server" Width="25px" />
                    </td>
                     <td style="width:125px;border-right-width:2px;border-right-style:solid;border-right-color:#000000">
                        Document Reference<br />
                        <asp:TextBox ID="TextBox25" runat="server" Width="45px" />
                    </td>
                     <td style="width:105px;border-right-width:2px;border-right-style:solid;border-right-color:#000000">
                        Line<br />
                        <asp:TextBox ID="TextBox26" runat="server" Width="25px" />
                    </td>
                     <td style="width:115px;border-right-width:2px;border-right-style:solid;border-right-color:#000000">
                        PC COMM LN<br />
                        <asp:TextBox ID="TextBox27" runat="server" Width="25px" />
                    </td>
                     <td style="width:115px;border-right-width:2px;border-right-style:solid;border-right-color:#000000">
                        Vendor Invoice #<br />
                        <asp:TextBox ID="TextBox28" runat="server" Width="85px" />
                    </td>
                     <td style="width:105px;border-right-width:2px;border-right-style:solid;border-right-color:#000000">
                      Fund<br />
                          <asp:DropDownList id="txtfund" runat="server"></asp:DropDownList>
                    </td>
                     <td style="width:105px;border-right-width:2px;border-right-style:solid;border-right-color:#000000">
                        Agency<br />
                          <asp:DropDownList id="txtagency" runat="server"></asp:DropDownList>
                    </td>
                     <td style="width:105px;border-right-width:2px;border-right-style:solid;border-right-color:#000000">
                        Org.<br />
                         <asp:DropDownList id="txtorg" runat="server"></asp:DropDownList>
                    </td>
                     <td style="width:105px;border-right-width:2px;border-right-style:solid;border-right-color:#000000">
                        Sub<br />
                        <asp:TextBox ID="TextBox32" runat="server" Width="25px" />
                    </td>
                     <td style="width:105px;border-right-width:2px;border-right-style:solid;border-right-color:#000000">
                        Activity<br />
                        <asp:TextBox ID="TextBox33" runat="server" Width="25px" />
                    </td>
                     <td style="width:105px;border-right-width:2px;border-right-style:solid;border-right-color:#000000">
                        Object<br />
                        <asp:TextBox ID="TextBox34" runat="server" Width="25px" />
                    </td>
                     <td style="width:115px;border-right-width:2px;border-right-style:solid;border-right-color:#000000">
                        Sub<br />
                        <asp:TextBox ID="TextBox35" runat="server" Width="25px" />
                    </td>
                     <td style="width:115px;border-right-width:2px;border-right-style:solid;border-right-color:#000000">
                       Rev Source<br />
                        <asp:TextBox ID="TextBox36" runat="server" Width="25px" />
                    </td>
                     <td style="width:105px;">
                        Sub<br />
                        <asp:TextBox ID="TextBox37" runat="server" Width="25px" />
                    </td>
                </tr>
            </table>   
    
            <table style="border-top-width:2px;border-top-style:solid;border-top-color:#000000">
                <tr valign="top">
                     <td valign="middle" style="font-size:large;font-weight:bold;" class="style4"></td>
                    <td style="width:105px;border-right-width:2px;border-right-style:solid;border-right-color:#000000">
                        <br /><br />Job #<br />
                        <asp:TextBox ID="TextBox39" runat="server" Width="45px" />
                    </td>
                    <td style="width:135px;border-right-width:2px;border-right-style:solid;border-right-color:#000000">
                        <br />
                        Rept<br />Category<br />
                         <asp:TextBox ID="TextBox40" runat="server" Width="25px" />
                    </td>
                     <td style="width:105px;border-right-width:2px;border-right-style:solid;border-right-color:#000000">
                        <br /><br />BS Acct<br />
                        <asp:TextBox ID="TextBox41" runat="server" Width="25px" />
                    </td>
                     <td style="width:105px;border-right-width:2px;border-right-style:solid;border-right-color:#000000">
                       <br /><br /> DISC<br />
                        <asp:TextBox ID="TextBox42" runat="server" Width="25px" />
                    </td>
                     <td style="width:105px;border-right-width:2px;border-right-style:solid;border-right-color:#000000">
                        <br />Description (30) Spaces<br />
                        <asp:TextBox ID="TextBox403" runat="server" onKeyUp="javascript:Count(this,30);" onChange="javascript:Count(this,30);" TextMode="MultiLine" Columns="30" Rows="2" />
                    </td>
                     <td style="width:105px;border-right-width:2px;border-right-style:solid;border-right-color:#000000">
                        <br /><br />Quant.<br />
                        <asp:TextBox ID="TextBox44" runat="server" Width="25px" />
                    </td>
                     <td style="width:105px;border-right-width:2px;border-right-style:solid;border-right-color:#000000">
                       <br /><br /> Amount<br />
                        <asp:TextBox ID="TextBox45" runat="server" Width="55px" />
                    </td>
                     <td style="width:105px;border-right-width:2px;border-right-style:solid;border-right-color:#000000">
                       Inc<br />/<br />Dec<br />
                        <asp:TextBox ID="TextBox46" runat="server" Width="25px" />
                    </td>
                     <td style="width:105px;">
    
                        P<br />/<br />F<br />
                        <asp:TextBox ID="TextBox47" runat="server" Width="25px" />
                    </td>
                </tr>
            </table>   
            </td>
            </tr>
            </table>        
            </div>
    
    <table id="sometable">
    <tbody>
    </tbody>
    </table>
    <table id="anothertable">
    <tr>
    <td> some other table </td>
    </tr>
    </table>
          <a href="#" id="more">Add More Rows</a>
         <div class="noprint" style="border-top-width:2px;border-top-style:solid;border-top-color:#000000"">
    
          </div>
    <input type="submit" value="Save" />
          <input type="reset" value="Reset" />
       </form>
    

    Javascript code:

    <script type="text/javascript">
    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 < rowCount; i++) {
                    index = index + 1;
    $("#sometable").append($("#template").html().replace(/_1/g, "_" + index));
                }
            }
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a datagridview that may or may not have rows selected when the
I have 2 tables that their rows have one on one relation.. For you
We have about 10K rows in a table. We want to have a form
We have a table in our database which has around 2,500,000 rows (around 3GB).
I have a database that gets a new row added for every time a
In our application the user is able to edit multiple rows at the same
Currently I have spreadsheets coming in that are formatted incorrectly. Our client sent out
We have a loop in our PHP code which inserts rows into a table.
Basically we have rows upon rows of programmers that do mundane tasks every day.
We have a timeline feature of our software. It shows rows of little blobs

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.