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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:58:02+00:00 2026-06-11T03:58:02+00:00

When triggered, the 3rd (bottom) row of a table is cloned. In the CSS,

  • 0

When triggered, the 3rd (bottom) row of a table is cloned. In the CSS, this row (#tr3) is set to: display:none; Here is the table row I am cloning:

<tr name="tr3" id="tr3">
    <td><input type="text" name="dt1" id="dt1"></td>
    <td><input type="text" name="fn1" id="fn1"></td>
    <td><a href="#" name="change1" id="change1">change</a></td>
    <td><a href="#" name="del1" id="del1">delete</a></td>
</tr>

This is the JQuery code to clone the row. Not mine, sadly, so I don’t understand all of it.

$("table tr:nth-child(4)").clone().find("input").each(function() {
    $(this).val('').attr('id', function(_, id) {
    return id + count;
});

Specifically, how does the function in line 2 work – what is the underscore?

Here’s what I came for, though. How can I:

  1. change the style to display:block for cloned rows, and
  2. update the ids of the anchor tags in the cloned rows. The IDs of the input fields Do update (e.g. fn1 => fn11, fn12, fn13, fn14, etc).

Thank you.

  • 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-11T03:58:04+00:00Added an answer on June 11, 2026 at 3:58 am

    Just for clarity:

    var $clone = $("table tr:nth-child(4)").clone();
    
    1. How to change the style to display:block for cloned rows?

      $clone.show();
      
    2. How to update the ids of the anchor tags in the cloned rows.

      $clone.find("a, input").each(function() {
        $(this).val('').attr('id', function(_, id) {
          return id + count;
        });
      });
      
    3. In the jQuery code above, how does the function in line 2 work – what is the underscore?

      The underscore (_) is a valid ECMAScript’s identifier name and it is used simply as a placeholder to be able to grab the second argument (id.)

    And everything altogether (untested.)

    $("table tr:nth-child(4)")
      .clone()
      .show()
      .find("a, input").each(function() {
        $(this).val('').attr('id', function(_, id) {
          return id + count;
        });
      });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a application which is triggered from browser. This application consumes around 800
I have this function that is triggered if a user clicks a div. The
I have a foreach loop inside a table to display the content from DB
This question triggered some confusion and many comments about whether the algorithms proposed in
I need to close the pop-window which is triggered from 3rd party site after
I was triggered by this SO question about (.NET 4.0) covariance and contravariance support
I have a table that will receive messages from a 3rd party software, I
When in a page triggered by an exception, what vulnerabilities is a php page
I have 2 java script functions triggered by two separate buttons. I am trying
Is there an event that is triggered after all Page_Load events have completed? How

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.