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ünde:</option>
<option>Ware falsch geliefert / falscher Inhalt</option>
<option>Ware falsch bestellt</option>
<option>Ware gefällt nicht</option>
<option>Ware passt nicht</option>
<option>Ware doppelt geliefert</option>
<option>Sonstiges</option>
<option>Ware defekt/beschä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>');
}
for (var x = 1; x = n; x++)needs a comparison, atm you are assigning the value of n to x, should read:for (var x = 1; x == n; x++)x < n.