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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:29:35+00:00 2026-05-13T13:29:35+00:00

I’m trying to add and remove some rows from a table using Jquery. But

  • 0

I’m trying to add and remove some rows from a table using Jquery. But I dont know how to remove the newly added rows. If I have a remove link it will work, but thats not what I want. I want to be able to call a js function that shall remove all items.

I have tried iterate over the items, but the count for the tr’s in the table are always 0.

    <script src="scripts/jquery-1.3.2.min.js"></script>    
<script language=javascript>
    function UpdateData() {
        var dataStructure = new Object();
        dataStructure.Start = "Added Start";
        $("#table tbody tr:first").remove();        
        InsertDataInToTable(dataStructure);        
    }

    function InsertDataInToTable(dataStructure) {
        var newRow = $("#table thead tr:first").clone();        
        newRow.find("td").eq(0).text(dataStructure.Start);
        newRow.insertAfter("#table tbody");
    }

Start

Inital start

  • 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-13T13:29:35+00:00Added an answer on May 13, 2026 at 1:29 pm

    I recommend trying to add the DOM elements manually and assign a class using addClass. Then you know which ones were added and which ones you want to remove.

    Then doing $(“.className”).remove(); might be cleaner.

    You could have them defaulted as a class ‘standard’ and using addClass(‘new’) and remove the $(‘.new’).remove();

    Or you can just assign them all the .ClassName and remove all of that class name when you’re ready.

    I don’t recommend using the prior recommendation of adding a fake attribute in the DOM like “newLine” because it’s not valid XHTML. If you use .addClass() you can easily manage things in a validated way.

    Hope this helps!

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

Sidebar

Ask A Question

Stats

  • Questions 432k
  • Answers 432k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer This may be helpful to you. function checkTextboxNotFilled(txtboxid) { var… May 15, 2026 at 2:42 pm
  • Editorial Team
    Editorial Team added an answer If you remove the cycle plugin code, you'll see that… May 15, 2026 at 2:42 pm
  • Editorial Team
    Editorial Team added an answer Well I don't know where you are from and if… May 15, 2026 at 2:42 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.