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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T03:38:28+00:00 2026-05-29T03:38:28+00:00

I have the following HTML <form action=sendform.php method=post id=monogramming-builder> <fieldset> <table> <tr> <th>Qty</th> <th>Colour</th>

  • 0

I have the following HTML

<form action="sendform.php" method="post" id="monogramming-builder">
  <fieldset>
    <table>
      <tr>
        <th>Qty</th>
        <th>Colour</th>
        <th>Size</th>
        <th>Name</th>
        <th>Remaining</th>
        <th>Remove</th>
      </tr>
      <tr>
        <td><input type="text" name="qty1" /></td>
        <td>
          <select name="colour1">
            <option value="">[Please Select]</option>
            <option value="Red">Red</option>
            <option value="Black">Black</option>
            <option value="White">White</option>
          </select>
        </td>
        <td>
          <select name="size1">
            <option value="">[Please Select]</option>
            <option value="Small">Small</option>
            <option value="Medium">Medium</option>
            <option value="Large">Large</option>
            <option value="XL">XL</option>
            <option value="2XL">2XL</option>
          </select>
        </td>
        <td><input type="text" name="name1" /></td>
        <td>18</td>
        <td><a href="javascript:;" class="remove">Remove Row</a></td>
      </tr>
    </table>
    <p><a href="javascript:;" class="addrow">Add a row</a></p>
  </fieldset>
</form>

When the .addrow link is clicked, I want a new row to be added, but for each of the names, I want to add 1 to them. I have the following javascript:

var x = 2;
var tablerow = '<tr><td><input type="text" name="qty'+ x++ +'" /></td><td><select name="colour'+ x++ +'"><option value="">[Please Select]</option><option value="Red">Red</option><option value="Black">Black</option><option value="White">White</option></select></td><td><select name="colour'+ x++ +'"><option value="">[Please Select]</option><option value="Small">Small</option><option value="Medium">Medium</option><option value="Large">Large</option><option value="XL">XL</option><option value="2XL">2XL</option></select></td><td><input type="text" name="name'+ x++ +'" /></td><td>18</td><td><a href="javascript:;" class="remove">Remove Row</a></td></tr>'; 

$('.addrow').click(function(){
  $('tr:last-child').after(tablerow);
});

Obviously this is incrementing up to 5 by the end.

My question is, can the increment only be run after the whole row’s been added?

  • 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-05-29T03:38:29+00:00Added an answer on May 29, 2026 at 3:38 am

    You are incrementing x each time you write x++. Remove ++ from first occurances of x, and leave it x++ only after the last one.

    For example, if you use the string : “b” + x++ + “b” + x++ + “b” + x++ , you will increment x three times, but if you are using it like “b” + x + “b” + x + “b” + x++ , you increment x only once.

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

Sidebar

Related Questions

I have following html form: <form method=post action=> <input type=hidden name=userid id=user value=<?php echo
I have a form with the following HTML below: <form id=course_edit_form name=course_form action=/courses/save method=post>
in the form action i have the following line\ <form action={URL} method=post target=_self id=xxx
I have the following html form <form action=/newPost id=submit_new method=get><div class=iwill> <div class=iwill-holder> <div
I have the following form in cakephp: <div class=quickcontactDisplay> <?php echo $form->create('Enquiry',array('action'=>'add','class'=>'quickcontact')); echo $form->hidden('visitor_id',
I have the following multi-select box in a HTML form, where user can select
Suppose I have the following HTML: <form id=myform> <input type='checkbox' name='foo[]'/> Check 1<br/> <input
I have a simple MVC form with the following elements: <%= Html.TextBox(FechaInicio) %> Which
i have the following html code : <FORM name=frmmail> <input id=dochtmlContent type=hidden name=dochtmlContent value=oldValue/>
im trying to achieve the following, in php i have a form like this:

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.