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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T10:43:37+00:00 2026-06-08T10:43:37+00:00

Having a hard time figuring out how to add an increment value for each

  • 0

Having a hard time figuring out how to add an increment value for each id attribute within the div contents with cloned jQuery object.

http://jsfiddle.net/hvK8d/

===================== HTML=====================

    <div class="upload-file-container">
  <div class="uploadFile left clearfix">
    <input type="file" id="FileUpload1">
    <table id="RadioButtonList1">
      <tbody>
        <tr>
          <td><input type="radio" value="Resume"  id="RadioButtonList1_1">
            <label for="RadioButtonList1_1">Resume</label></td>
          <td><input type="radio" value="Letter of Recommendation"  id="RadioButtonList1_2">
            <label for="RadioButtonList1_2">Letter of Recommendation</label></td>
          <td><input type="radio" value="Other"  id="RadioButtonList1_3">
            <label for="RadioButtonList1_3">Other</label></td>
        </tr>
      </tbody>
    </table>
  </div>
  <a href="javascript:;" class="remove left">Remove</a> </div>
<div class=""><a class="plus" href="javascript:;">plus one</a></div>

===================== JQUERY =====================

    //Cloning upload file control
$('.remove').live('click', function () {
    if (confirm("Are you sure you wish to remove this item?")) {
        $(this).parent().slideUp('fast', function () {
            $(this).remove();
        });
    }
    return false;
});

$('.plus').click(function () {
    console.log('cloning');
    var divCloned = $('.upload-file-container:first').clone();
    divCloned.hide().insertAfter('.upload-file-container:last').slideDown('fast');
    return false;
});
  • 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-08T10:43:39+00:00Added an answer on June 8, 2026 at 10:43 am

    For the sake of completeness I will put here a small solution making use of a “template.”

    A class for hiding the template:

    .upload-file-container.template {
      display: none;
    }  ​
    

    A small function to do replacements:

    $.fn.template = function(variables) {
      return this.each(function() {
        this.innerHTML = this.innerHTML.replace(/{{(.+)}}/g, function(match, variable) {
          return variables[variable];
        });
        return this;
      });
    };
    

    A template:

    <div class="upload-file-container template">
      <div class="uploadFile left clearfix">
        <input type="file" id="FileUpload{{id}}">
        <table id="RadioButtonList{{id}}"><tbody>
          <tr>
            <td>
              <input type="radio" value="Resume"  id="RadioButtonList{{id}}_1">
              <label for="RadioButtonList{{id}}_1">Resume</label>
            </td>
          </tr>
        </tbody></table>
      </div>
    </div>
    

    Usage:

    var count = 0;
    
    var divCloned = $(".upload-file-container.template")
      .clone()
      .removeClass("template")
      .template({
        id: count++
      });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a hard time figuring out how i can add an arraylist into
I'm having a hard time figuring out how queue's work in jQuery, especially the
I am new here, but I am having hard time figuring out how to
Having a hard time figuring out why this alert code is being called once
Having a hard time figuring out the best way to do this... I have
I am having a hard time figuring out how to get cascading drop down
I am having a hard time figuring out what flags to pass to g++
I am having a hard time figuring out how to show an Image (or
I am having a hard time figuring out good reasons for the dependency property.
I am having a hard time figuring out how to get the property list

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.