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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:37:49+00:00 2026-05-25T12:37:49+00:00

I currently have several if statements that populate a specific table after the button

  • 0

I currently have several if statements that populate a specific table after the button refresh has been clicked.

After the button is clicked again I need to remove the previous table that is polulated. How can I do that?

if (strDate == "Jan-2010") {
    var TableRowHtml = "<table id='box-table-a'>";
    TableRowHtml +="<TR><TH 'style='width: 50px'>OPERATIONS</TH></TR>";
    TableRowHtml +="<TR><TH 'style='width: 50px'>Unit Costs</TH></TR>";
    TableRowHtml +="<TR><TD>" + Total[0] + "</TD></TR>";
}
else if (strDate == "Feb-2010") {
    var TableRowHtml1 = "<table id='box-table-a'>";
    TableRowHtml1 +="<TR><TH 'style='width: 50px'>OPERATIONS</TH></TR>";
    TableRowHtml1 +="<TR><TH 'style='width: 50px'>Unit Costs</TH></TR>";
    TableRowHtml1 +="<TR><TD>" + Total[1] + "</TD></TR>"; 
}
else if (strDate == "Mar-2010") {
    var TableRowHtml2 = "<table id='box-table-a'>";
    TableRowHtml2 +="<TR><TH 'style='width: 50px'>OPERATIONS</TH></TR>";
    TableRowHtml2 +="<TR><TH 'style='width: 50px'>Unit Costs</TH></TR>";
    TableRowHtml2 +="<TR><TD>" + Total[2] + "</TD></TR>"; 
}
else if (strDate == "Apr-2010") {
    var TableRowHtml3  = "<table id='box-table-a'>";
    TableRowHtml3 +="<TR><TH 'style='width: 50px'>OPERATIONS</TH></TR>";
    TableRowHtml3 +="<TR><TH 'style='width: 50px'>Unit Costs</TH></TR>";
    TableRowHtml3 +="<TR><TD>" + Total[3] + "</TD></TR>"; 
}

Dropdown code:

<tr><td><select id="combobox">
      <option value="Jan-2010">Jan/2010</option>
      <option value="Feb-2010">Feb/2010</option>
      <option value="Mar-2010">Mar/2010</option>
      <option value="Apr-2010">Apr/2010</option>
      <option value="May-2010">May/2010</option>
      <option value="Jun-2010">Jun/2010</option>
  </select></td>
  <td><input type="button" id="RefreshMetrics"  value="Refresh"></td>
</tr>
</select></td>
<td><input type="button" id="RefreshMetrics"  value="Refresh"></td>
</tr>
</table>

/////////////////////////////////////////////////////////////////////////////

Can place the below code in each specfic if statement e.g… remove each table that is not needed … for that paticular month

                      if (strDate == "Jan-2010") 

                    {


                   $('TableRowHtml1').last().remove();
                   $('TableRowHtml2').last().remove();
                   $('TableRowHtml3').last().remove();



       var TableRowHtml = "<table id='box-table-a'>";     
       TableRowHtml +="<TR><TH 'style='width: 50px'>OPERATIONS</TH></TR>";           
 TableRowHtml +="<TR><TH 'style='width: 50px'>Unit Costs</TH></TR>";                   TableRowHtml +="<TR><TD>" + Total[0] + "</TD></TR>";     
                }           
  • 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-25T12:37:49+00:00Added an answer on May 25, 2026 at 12:37 pm

    You can use Jquery remove API.

    http://api.jquery.com/remove/

    $('table').last().remove();

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

Sidebar

Related Questions

I have a class that currently has several methods that take integer parameters. These
I have several lists in a sitecollection that are currently using ListTemplateID 101 (DocumentLibary).
Currently I'm running several websites that have several (branded) duplicates each, in the same
I currently have a list view which has several rows of data and I
I currently have a Table [org.eclipse.swt.widgets.Table] with several TableColumns; however, due to UI space
I have a SQlite3 table that has typeless columns like in this example: CREATE
I have several classes in an application that I am currently building, and I
I have recently started work on a project that has already been running for
I receive a list of image URLs and currently I have several hidden img
I currently have a website where I'm hosting a webservice with several web methods,

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.