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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:22:10+00:00 2026-05-30T17:22:10+00:00

I am trying to empty all the rows inside the tbody on click of

  • 0

I am trying to empty all the rows inside the tbody on click of a new row. This is the javascript i am using:

$('#pro tr').click(function() {
    $('#pro_basket > tbody').empty();
        $.ajax({
            type: "post", url: "data.php", data: "index="+index,
            success: function(data) {
            $('#pro_basket > tbody').after(data);
        }
    });
});

My table markup is simple:

<table id='pro_basket'>
   <thead>
       <th>Column 1</th>
       <th>Column 2</th>
   </thead>
   <tbody>
   </tbody>
</table>

I want to empty the rows that exist in pro_basket but $('#pro_basket > tbody').empty(); isn’t really helping.

  • 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-30T17:22:11+00:00Added an answer on May 30, 2026 at 5:22 pm
    $('#pro_basket > tbody').html(data);
    

    html() method will replace all exisitng elements in tbody

    Your after() method would put new rows into table after the tbody which is not likely what you wanted

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

Sidebar

Related Questions

I'm trying to iterate through all the empty textboxes in a table and change
I'm trying to check if asp.net textbox is empty or not using java script.
I'm trying to catch a double-click event in a TreeView's empty area to create
I am trying to count all the rows in the month of December: select
I'm trying to insert a bunch of rows into an empty UITableView in one
I'm trying to replace all my empty select boxes with a text message but
i'm trying to get the Pearson correlation coefficient for all rows in a data
I need to get all the rows from result object. I’m trying to build
I am trying to find all occurrences of a string in a field using
I'm trying to use empty() in array mapping in php. I'm getting errors that

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.