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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:01:45+00:00 2026-06-13T10:01:45+00:00

i m using jquery to add new row and delete them but my problem

  • 0

i m using jquery to add new row and delete them but my problem is that when i click on minus button it start deleting the row from bottom to up and not delete the particular row.means if i filled the data in 10 rows and now want to delete the 5th row then on cliking minus button on 5th row it removes 10th, 9th and so on…and i want that only 5th row will bdeletedhow could it will b possible.

Here is my jquery file:

$(document).ready(function(e) {
    $("#add").click(function() {
        $('#mytable tbody>tr:last').clone(true).insertAfter('#mytable tbody>tr:last');
        var last_sn = $('#mytable tbody>tr:last>td:first').html();
        $('#mytable tbody>tr:last>td:first').html(parseInt(last_sn) + 1);
        return false;
    });
    $('#minus').click(function() {
        $('#mytable tr:last-child').remove();
    });
});​
  • 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-13T10:01:45+00:00Added an answer on June 13, 2026 at 10:01 am

    $(‘#mytable tr:last-child’).remove(); will allways remove the last row.

    If you have several minus buttons then you should not use the same id (#minus) use a class instead.

    fiddle: http://jsfiddle.net/k8dAs/

    $('.minus').click(function()
    {
      $(this).parents("tr").remove();
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using jquery.tablednd.0.7.min.js to drag and drop table rows. When I add new row
I'm using Jquery to add a row to the end of a table, that
I'm using jQuery to dynamically add new divs containing a few fields. I'm adding
I'm trying to add jQuery using Greasemonkey's @require / @include method, but it doesn't
I'm creating a CMS using jQuery and AJAX. When I click, my Add Campaign
Possible Duplicate: How to use jQuery to add a new row to a table,
I'm using jQuery to dynamically add rows to my HTML table on a button
i am creating the textboxes dynamically using jquery on a button click. <table width=100%
I have a button that will create a new entry (row in a table)
I am using jquery to add mulitple new addTask form elements to a ul

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.