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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:46:21+00:00 2026-06-13T08:46:21+00:00

I have the following table inside my markup:- <table id=tablelist border=1> <thead> <tr> </tr>

  • 0

I have the following table inside my markup:-

<table id="tablelist" border="1">

       <thead>
        <tr>
    </tr>
    </thead>
       <tbody></tbody>
       </table>

and i am building the above table using the following Java script which will be fired when the user click on a link:-

function getprocesslist(result) {
        $('#tablelist tbody').remove();

    var str = 'Total Number Of Processes:- ' + result.total.toString();
        $('#total').text(str.toString());

        var str1 = '<tr><th>' + 'Process Name' + '</th><th>' + 'Process Requestor ID' + '</th><th>' + 'Process State' + ' </th><th>' + 'Process Start Date' + ' </th><th>' + 'Process Due Date' + ' </th></tr>';
        $('#tablelist tr:last').after(str1);
    $.each(result.data, function (key, val) {
        var str2 = '<tr><td>' + val.name + '</td><td>' + val.requesterId + '</td><td>' + val.state + '</td><td>' + val.startedTime + '</td><td>' + val.due + '</td></tr>';

        $('#tablelist tr:last').after(str2);

    });
   }

But the problem is that when the user clicks multiple time on the link the new data will be shown under the old table instead of removing the old data. i think the problme with my code is that on the first clink the <tbody></tbody> is remove and i can not reference it again using Jquery ? any idea on how i can solve this problem?

BR

  • 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-13T08:46:22+00:00Added an answer on June 13, 2026 at 8:46 am

    You are removing the tbody, then adding everything to the table head. Instead, empty the head and the body and append the content in the right places:

    function getprocesslist(result) {
        $('#tablelist tbody, #tablelist thead').empty();
    
        var str = 'Total Number Of Processes:- ' + result.total.toString();
        $('#total').text(str.toString());
    
        var str1 = '<tr><th>' + 'Process Name' + '</th><th>' + 'Process Requestor ID' + '</th><th>' + 'Process State' + ' </th><th>' + 'Process Start Date' + ' </th><th>' + 'Process Due Date' + ' </th></tr>';
        $('#tablelist thead').append(str1);
    
        $.each(result.data, function (key, val) {
            var str2 = '<tr><td>' + val.name + '</td><td>' + val.requesterId + '</td><td>' + val.state + '</td><td>' + val.startedTime + '</td><td>' + val.due + '</td></tr>';
            $('#tablelist tbody').append(str2);
        });
    }​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following view inside my asp.net MVC web application:- <table id=tablelist border=1>
I have the following table structure inside a view which gets displayed in the
I have following CSS: table tbody tr:last-child td { padding-top: 7px; border-bottom: 0; }
I have following html <table> <th>Name</th><th>age</th> <tbody> <tr><td>A</td><td>25</td></tr> <tr><td>B</td><td>30</td></tr> <tr><td>C</td><td>34</td></tr> <tr><td>D</td><td>32</td></tr> </tbody> </table> I
I have following page in which there is a div menu. Inside menu we
I have configured spring security core plugin using requestmap table inside the database.. Now
I have the following code: Index.cshtml: @using System.Web.Script.Serialization @model MvcApplication3.ViewModels.PersonViewModel <script src=../../Scripts/knockout-2.1.0.js type=text/javascript></script> <!--
Inside my Table view controller I have following method -(BOOL)isValidCoordinate:(CLLocationCoordinate2D)coordinate { //This is just
I have a table inside of a div with the following style: #data {
I have the following check box list inside table. I want to hilight 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.