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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T02:32:17+00:00 2026-05-16T02:32:17+00:00

I was looking at adding rows dynamically to my HTML table using jQuery with

  • 0

I was looking at adding rows dynamically to my HTML table using jQuery with the following requirement.

The table has 9 columns, of which 1 columns has a button for adding a new row.
The new row added should be added after the current row and have the first 7 columns blank, 8th column should be a exact replica of the previous rows 8th columns, and 9th column should have option for adding another row/deleting row(something like +/- buttons).

My HTML code is as follows:

<table id='contactInfo'>
    <thead>...</thead>  
    <tbody>  
        <tr>  
            <td>...data for the first 7 columns..</td>  
            <td>  
                <input type="text" id="newContactComment<%=rCount %>" name="newContactComment" size="45">
                <br>
                <input type="checkbox" id="commentText<%=rCount %>" name="commentText" value="<%=c.getComment_text() %>" class="consComment">&nbsp;
                <%=c.getComment_text() %><br> 

And the jQuery code is as follows:

$("#contactInfo").each(function(){  
    $("button.addCommentRow", this).live('click', function() {  
        var html = '<tr><td>..blanks for first 7 columns </td> <td>...what goes in here..??..</td>  </tr>';  
        var row = $(this).closest('tr'); // get the parent row of the clicked button  
        $(html).insertAfter(row);  // insert content  
                 ...code to delete the newly added row..  

I’ve included the part that I was getting confused about in ‘what goes in here..??..’
Any suggestions/ideas would be highly appreciated.

Thanks,
Pritish.

  • 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-16T02:32:18+00:00Added an answer on May 16, 2026 at 2:32 am

    get the content of the 8th column of the clicked row

    var column_eight = row.find("td:nth-child(8)").html();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey all. I am adding a More Rows button to a table within a
Looking at adding some data graphing to a new iPhone app in development (ala
Looking to run a query using multiple left joins. The following query works. SELECT
I have a table of data which is generated dynamically with Javascript. Every few
I have an object which I'm filling with objects containing 2 table rows each.
I have a page that is creating dynamically created rows in a table with
I'm having trouble figuring out how to maintain my table stripes after adding new
I have implemented a grid-looking structure (say 5 rows and 10 columns) for an
I'm looking into adding a chat feature on my site (it's somewhat like a
I am looking into adding unit tests at work. I used MbUnit in the

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.