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

The Archive Base Latest Questions

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

In my web application, I was dynamically adding/deleting rows from my HTML table using

  • 0

In my web application, I was dynamically adding/deleting rows from my HTML table using jQuery.

I had a requirement that I needed to delete individual td elements(and not entire row).

My jQuery code is as follows:

$(function () {

    /* adding new row to existing table */
    // HTML template of a row
    $("#contactInfo").each(function () {
        $("button.addCommentRow", this).live('click', function () {

            var curr_row = $(this).closest('tr');
            var html = '<tr><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> ' + col_ninth + '</td> <td><button type="button" class="addCommentRow">+</button> <button type="button" class="deleteCommentRow">-</button> </td> </tr>';

            var newRow = $(html).insertAfter(curr_row); // add after the last
            newRow.find('.addCommentRow, .deleteCommentRow').button();
            newRow.find('.deleteCommentRow').button().click(function () {

                newRow.find("td:nth-child(9)").remove();
                newRow.find("td:nth-child(10)").remove();

            });
        });
    });
});

So, on deleting I wanted to remove the 9th and the 10th td element from my row.

The above code(only the deletion part) does not seem to work.
Any ideas/suggestions to get working will 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:51:53+00:00Added an answer on May 16, 2026 at 2:51 am

    you can try something like this, try the Demo : http://jsfiddle.net/HXB4Z/

    HTML :

    <table border=2>
        <tr>
            <td>jQuery</td>
            <td>mootools</td>
        </tr>
        <tr>
            <td>Dojo</td>
            <td>FUEL</td>
        </tr>
        <tr>
            <td>Raphael</td>
            <td>Rico</td>
        </tr>
        <tr>
            <td>SproutCore</td>
            <td>Lively Kernel</td>
        </tr>
    </table>
    

    javascript :

    $(function() {
       $('tr')
           .find('td')
           .append('<input type="button" value="Delete" class="del"/>')
           .parent()//traversing to 'tr' Element
           .append('<td><input type="button" value="Delete row" class="delrow" /></td>');
    
        $('.del').click(function() {
           $(this).parent().remove(); //Deleting TD element
        });
    
        $('.delrow').click(function(){
           $(this).parent().parent().remove(); //Deleting the Row (tr) Element
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web application that dynamically creates a web page using usercontrols. Within
I have an iPhone web application that creates a meta viewport tag dynamically, using
I'm building a quiz web application that dynamically generates from a database on my
I'm building a quiz web application that is dynamically generated from a database on
I have a web application that uses jQuery to dynamically create an silverlight object.
I have a web application that dynamically loads assemblies based on database configuration entries
I am developing a single web application that will dynamically change its content depending
I'm developing a web application that shows some controls and descriptions dynamically (I don't
I have a web application that uses a relational database (MySQL). We're adding a
I am developing a web application such a way that my codes dynamically generating

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.