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

  • Home
  • SEARCH
  • 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 8626593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:04:13+00:00 2026-06-12T08:04:13+00:00

I’ve got a table which has a button to add a new row. When

  • 0

I’ve got a table which has a button to add a new row. When this new row is added, the field RS_Staff_Title1 becomes incremented to RS_Staff_Title2 and so on. What this button also does is adds a row to another table.

I’ve then got this function to copy the contents of RS_Staff_Title1 into a field on this other table as you type.

$("#RS_Staff_Title1").keyup(function() {
        var value = $(this).val()
        $("p").text(value);
    }).keyup();

What I need to achieve though is for any content in RS_Staff_Title1 on StaffTable to be copied into RS_Staff_Title1 on ResourceTable and so on for however many increments are made

UPDATE:

My HTML for the row in the Staff table is:

<tr>
<td><input id="RS_Staff_Title1" name="RS_Staff_Title1" style="width:100%;"></td>

The JS to add a row to both tables is:

$("#add_row").click(function() {
    var row = $("#staff tbody > tr:last"),
        newRow = row.clone(true);
    newRow.find("input").each(function() {
        var num = +(this.id.match(/\d+$/) || [0])[0] + 1;
        this.id = this.id.replace(/\d+$/, "") + num;
        this.name = this.id;
    });
    newRow.insertAfter(row);
    return false;
});
$("#add_row").click(function() {
    var row = $("#resource-cost tbody > tr:last"),
        newRow = row.clone(true);
    newRow.find("input").each(function() {
        var num = +(this.id.match(/\d+$/) || [0])[0] + 1;
        this.id = this.id.replace(/\d+$/, "") + num;
        this.name = this.id;
    });
    newRow.insertAfter(row);
    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-12T08:04:14+00:00Added an answer on June 12, 2026 at 8:04 am

    In order to not bind keyup event for every new row you can use .live (.on in latest jQuery) to add it only once and make it work for any new items added. Besides, ID must be unique and you can’t have two elements with ID RS_Staff_TitleN.
    I would place a class on RS_Staff_Title elements and bind keyup handler like this:

    $(document).on("keyup", ".StaffTableTitle", function() {
        var value = $(this).val()
        var id = $(this).data("rowindex");
        $(".ResourceTableTitle #RT_Staff_Title" + id + " p").text(value);
    }); 
    

    RT_Staff_Title – suggested ID for RS_StaffTitle in ResourceTable in order to have unique IDs

    .data("rowindex"); should be set like this .data("rowindex", index) for newly added rs_staff_title element when you create it (just easier to get it from there than from ID and it is needed to find corresponding element in ResourceTable later)

    newRow.find("input").each(function() {
            var num = +(this.id.match(/\d+$/) || [0])[0] + 1;
            this.id = this.id.replace(/\d+$/, "") + num;
            $(this).data("rowindex", num);
            this.name = this.id;
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I've got a string that has curly quotes in it. I'd like to replace
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have an array which has BIG numbers and small numbers in it. I
I want to count how many characters a certain string has in PHP, but
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small

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.