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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:18:05+00:00 2026-05-24T06:18:05+00:00

I have been researching the JQuery way to add table rows dynamically. One excellent

  • 0

I have been researching the JQuery way to add table rows dynamically. One excellent thread is: How to Copy Table Row with clone in jquery and create new Unique Ids for the controls, with the last example being the one I am targeting in this post.

I have a fiddle giving an example of what I am trying to do. This fiddle does not work exactly yet, but I am working on it,

The main issue I am having is getting the table row copy to set different types of column elements id and default values, and even row attributes. In essence, how do I extend this to be more robust.

Thanks to Nick Craver, I am trying to use this:

// do Add row options
$("#Add").click(function() {

    var rowCount = $('#secondaryEmails >tbody >tr').length;
    var i = rowCount + 1;
    alert('rowCount: ' + rowCount + ', new row: ' + i);
    $("#secondaryEmails >tbody tr:first").clone().find("input").each(function() {
        $(this).attr({
            'id': function(_, id) {
                return id + i
            },
           'name': function(_, name) {
                return name + i
            },
            'value': ''
        });
    }).end().appendTo("#secondaryEmails >tbody");
});

which will copy and insert a row nicely, but if I have a row with a radio button, input box, and select list, I cannot figure out how to tell it to set the default value of each element depending on the type of element. I am trying to use a template row, but that means I need to set the style:display attribute on the row from none to table-cell. Again, how?

Please see the fiddle mentioned previously for a working example.

  • 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-24T06:18:06+00:00Added an answer on May 24, 2026 at 6:18 am

    This is now showing the row: http://jsfiddle.net/EwQUW/5/

    You would want to use .show() on the element to show it, which effectively sets the style to display:block instead of display:none;

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

Sidebar

Related Questions

I have been researching asynchronous messaging, and I like the way it elegantly deals
Been working on a personal add-in for VS 2008 and have been researching automation
I've been researching all over for this, basically I have a table that displays
I have been researching around trying to find the best way to begin developing
Im new to jQuery and have been researching and playing with it as much
I have been researching a way to get the SQL statements that are built
I have been researching jquery deferred objects for a while now and I'm stumped
I have been researching FRP and found a bunch of different implementations. One model
I have been researching this one for awhile. I found several resources on the
I have been researching and playing with functional programming lately, solely to broaden my

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.