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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:20:33+00:00 2026-06-11T05:20:33+00:00

I was wondering if anyone could help, I have a form that needs 4

  • 0

I was wondering if anyone could help, I have a form that needs 4 fields at each time to be cloned.

Basically I have a row (This is what i want cloned, with everything in it) – But each element has a number to identify it, and an ID etc. So basically when I add an additional row, I need it to change the corresponding numbers by 1, but where there are 4 elements in a row, I’d need them to increase by 4 overall each time, so the element cloned that was 1, would become 5, that was 2 become 6 etc.

The code for my form is below, and hopefully will make a bit more sense.

I’ve tried using the Sheepit! jquery plugin but can’t get the numbers to increase sequentially with each other.

<div class="row">
    <div class="element">
        <label id="label-element-15" class="label">
            <span class="labelelementvalue">Weight</span>
            <span class="required">*</span>
        </label>
        <div class="errormessage" id="errormessage-element-15"></div>
        <div class="option-container">
            <input class="af-inputtext af-formvalue  " type="text" name="element-15" id="element-15" value="">
        </div>
        <input type="checkbox" style="display:none" value="15" checked="" name="requiredelement[]" id="requiredelement-15">
    </div>
    <div class="element">
        <label id="label-element-16" class="label">
            <span class="labelelementvalue">Length</span>
            <span class="required">*</span>
        </label>
        <div class="errormessage" id="errormessage-element-16"></div>
        <div class="option-container">
            <input class="af-inputtext af-formvalue  " type="text" name="element-16" id="element-16" value="">
        </div>
        <input type="checkbox" style="display:none" value="16" checked="" name="requiredelement[]" id="requiredelement-16">
    </div>
    <div class="element">
        <label id="label-element-17" class="label">
            <span class="labelelementvalue">Width</span>
            <span class="required">*</span>
        </label>
        <div class="errormessage" id="errormessage-element-17"></div>
        <div class="option-container">
            <input class="af-inputtext af-formvalue  " type="text" name="element-17" id="element-17" value="" >
        </div>
        <input type="checkbox" style="display:none" value="17" checked="" name="requiredelement[]" id="requiredelement-17">
    </div>
    <div class="element">
        <label id="label-element-18" class="label" >
            <span class="labelelementvalue">Height</span>
            <span class="required">*</span>
        </label>
        <div class="errormessage" id="errormessage-element-18"></div>
        <div class="option-container">
            <input class="af-inputtext af-formvalue" type="text" name="element-18" id="element-18" value="">
        </div>
        <input type="checkbox" style="display:none" value="18" checked="" name="requiredelement[]" id="requiredelement-18">
    </div>
</div>

So basically where it says element-[number] or value=”[number]” in the hidden checkbox is the number I’d want to increase on each clone.

Any help would be much appreciated! 🙂

  • 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-11T05:20:34+00:00Added an answer on June 11, 2026 at 5:20 am

    Here’s a fiddle

    Basically, you just need to get a counter going.

    var counter = 19; //start index
    
    //clone is a button I created to clone the row
    $('#clone').click(function() {
        //clone the first row
        var newRow =  $('div.row:first').clone();
    
        //for every div.element, update the name, id, value 
        newRow.find('div.element').each(function() {
            $(this).find('label.label').attr('id', 'label-element-' + counter);
            $(this).find('input.af-inputtext').attr('name', 'element-' + counter).attr('id', 'element-' + counter);
            $(this).find('input[type="checkbox"]').val(counter);
    
            //increment the counter
            counter++;
    
        });
    
        //insert the new row after the last one
        $('div.row:last').after(newRow);
    
    
    
        //return false... just because clone is a <a> tag
        return false;
    
    
    })
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was wondering if anyone could help with this. Let' say I have a
I was wondering if anyone could help me with this. I have to create
Wondering if anyone can help with the following. Basically I have a form which
I was wondering if anyone could help me with this problem: I have to
I was wondering if anyone could help me animate an image on hover that
I was wondering if anyone could help me with this problem i'm having. I
Just wondering if anyone could help me with this. I'm new to actionscript, and
I was wondering if anyone could help me vectorize these for loops I have
I was wondering if anyone could help me out with this. I am running
Was wondering if anyone could help me on background threading on Android. I have

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.