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 8596209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:37:18+00:00 2026-06-12T00:37:18+00:00

I have a form where you can add field by clicking an add-button to

  • 0

I have a form where you can add field by clicking an add-button to fill them with data in the first step. In the second step i’d like to get this data displayed but my loop doesn’t correctly.

This is the origin table. By clicking the add-button a new tr-tag with new IDs (item2, Ditem2…) is generated.

<table cellpadding="0" cellspacing="0" class="table" id="rp-article">
    <tbody>
        <tr class="rowb">
            <td class="col1 cell">
                <input disabled="disabled" id="count1" maxlength="10" name="count1" size="1"
                type="text" value="1" />
            </td>
            <td class="col2 cell">
                <input id="item1" maxlength="100" name="item1" size="15" type="text" value="Artikelnummer"
                />
            </td>
            <td class="col3 cell">
                <input id="Ditem1" maxlength="100" name="Ditem1" size="48" type="text"
                value="Beschreibung..." />
            </td>
            <td class="col4 cell">
                <input id="Aitem1" maxlength="100" name="Aitem1" size="5" type="text"
                value="Menge" />
            </td>
            <td class="col5 cell">
                <input id="Pitem1" maxlength="100" name="Pitem1" size="10" type="text"
                value="Preis" />
            </td>
            <td class="col6 cell">
                <select id="Ritem1" name="Ritem1">
                    <option>Retourengr&uuml;nde:</option>
                    <option>Ware falsch geliefert / falscher Inhalt</option>
                    <option>Ware falsch bestellt</option>
                    <option>Ware gef&auml;llt nicht</option>
                    <option>Ware passt nicht</option>
                    <option>Ware doppelt geliefert</option>
                    <option>Sonstiges</option>
                    <option>Ware defekt/besch&auml;digt/fehlerhaft</option>
                </select>
        </tr>
    </tbody>
</table>

Now I’d like do grab them all and display them in p-Tags (n is the count variable for the amount of tr):

for (var x = 1; x = n; x++) {
  $('#pt_title2').after('<p id=#pt_article' + x'></p>');
  $('#pt_article'+x).html('<b>#' + x'</b>'); 
}
  • 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-12T00:37:20+00:00Added an answer on June 12, 2026 at 12:37 am

    Your for loop is not correct. Try this instead:

    for (var x = 1; x < n; x++) { // <--- note the < instead of =
      $('#pt_title2').after('<p id=#pt_article' + x + '></p>'); // you were missing a +
      $('#pt_article'+x).html('<b>#' + x + '</b>');  // same here
    }
    

    Now the loop will run for as long as x is smaller than n… which I think you want.

    Possibly you could need to use <= (less than or equal to), if you want the loop to run until x has the same value as n. Depends on how you have the count, ids etc set up for your elements.

    The for loop condition isn’t “run until this is true”, it’s “run while this is true”.

    You should also possibly check out jQuery’s each function.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have form, where some fields are looks like rows, so I can add/delete
I have a form in witch users can add their working hours view them
Lets say I have a form field. Also I can dynamically add more fields,
I have a form into which the user can add more fields to fill
I have a form where users can add input fields with jQuery. <input type="text"
I have a dynamic form that users can add/delete sets of input fields. I
I want to have a Form that can Add or Delete TextFields. I was
I have a form which users can add controls to and when they right
I have a simple form where a user can add, edit, and delete people
I would like to have a form that can submit to two different action

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.