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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:21:06+00:00 2026-05-23T04:21:06+00:00

I had gone through many solutions for the above problem but they are quite

  • 0

I had gone through many solutions for the above problem but they are quite confusing as I ‘cell left & cell right’ didn’t seem to be applicable in my case.

Using clone method of jQuery is quite simpler, but there is also one problem. The problem is that when I clone the last row it will copy all data from above row. another problem attached to it is : ID. When cloning is done, same ‘name’ & ‘ID’ is copied which will create problem while posting data, so I need dynamics in this too. So I m not getting that how can we pass data to clone function which will solve dynamic ‘attribute’ problem.

CODE:

<table id="advertisement_main_table" class="table" cellpadding="4" cellspacing="1" width="100%;">  
<tr class="odd align_center">
                    <td>1.</td>
                    <td><input type="text" id="ad_elements" class="textbox_150_with_border"></td>
                    <td><textarea id="ad_description" rows="01" cols="50" class="advertisement_textarea" ></textarea></td>
                    <td><input type="text" id="ad_duration" class="textbox_60_with_border"></td>
                    <td><input type="text" id="ad_loop_day" class="textbox_60_with_border"></td>
                    <td><input type="text" id="ad_seconds_played" class="textbox_100_with_border"></td>
                </tr></table>

Now in above code <td>1.</td> is hardcoded but how to appended ‘suffix’ in every id like ‘ad_element_1′,’ad_duration_1′,,,’ad_element_2′,’ad_duration_2’ in next <tr> and so on..

I hope you understand what I want to say

  • 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-23T04:21:06+00:00Added an answer on May 23, 2026 at 4:21 am

    Part of the solution is to use <input type="text" name="ad_elements[]" class="textbox_150_with_border" /> instead of an id there. That way when it’s cloned the name is still valid, and you’ll just receive an array of ad_elements entries when it’s posted.

    For the rest, like turning the “1.” into “2.”, I’m afraid there is no magic bullet, you’ve to do that yourself after the cloning, it’s fairly easy in this particular case though:

    $(new_tr).find(‘td:first-child’).text(function(text) {
    return (parseInt(text)+1) + “.”;
    });

    Just replace new_tr by whatever variable contains the cloned TR.

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

Sidebar

Related Questions

I had gone through the tutorial in Prestashop at http://forge.prestashop.com:8081/display/PS14/Using+the+REST+webservice but it doesn't guide
I had recently starting learning openGLES and right now I had gone through some
I've gone through quite a few articles on the repository pattern and had some
Having had some Sql Compact db corruption issues in the past and gone through
I've gone through a bunch of other examples, but I cannot get a video
I have searched for possible solutions for days, but have had no luck at
Recently i had gone through Scottgu's Blog where he had jotted of Jquery Templates
i want to generate Key Keypresses programmatically in android. i had gone through sample
Had a few problems getting background-image displaying in Firefox, I made it work but
Had a good search here but can't see anything that gets my mind in

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.