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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:29:29+00:00 2026-05-24T05:29:29+00:00

I have a table with a thead and tbody sections. I have applied a

  • 0

I have a table with a thead and tbody sections. I have applied a slideToggle on this successfully, but the animation is broken.

When a user clicks on the thead, I want the contents of the tbody to slide up. Currently what happens is the section simply disappears, without any animation.

Here is the table

<table>
  <thead>
    <tr>
      <td colspan="3">TABLE HEADING</td>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td class="first" colspan="1">Cell Contents</td>
      <td colspan="1">Cell Contents</td>
      <td colspan="1">Cell Contents</td>
    </tr>
  </tbody>
</table>

And here is the jQuery I am using:

   <script type="text/javascript" language="javascript">
      $(document).ready(function () {
         $("thead").click(function () {
               $(this).next("tbody").slideToggle("slow");
            }
         )
      });
   </script>
  • 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-24T05:29:30+00:00Added an answer on May 24, 2026 at 5:29 am

    It disappears because <tbody> normally will get no shorter than the tallest td, no matter what you set its height to with CSS.

    This is why the natural-height tbody just seems to disappear, while the one with artificial extra-height appears to run until the tr reached its natural height.

    You can kludge around this with tbody {display:block;}. See the kludge at jsFiddle.

    But, notice the effect that has when a table height is set.

    Probably, the best way is to wrap the whole table in a div and slideToggle that, like so:

    <table class="AbbyNormal">
        <thead><tr><td colspan="3">TABLE HEADING</td></tr></thead>
    </table>
    <div class="tableWrap">
        <table class="AbbyNormal">
          <tbody>
            <tr>
                <td class="first" colspan="1">Cell Contents</td>
                <td colspan="1">Cell Contents</td>
                <td colspan="1">Cell Contents</td>
            </tr>
          </tbody>
        </table>
    </div>
    

    Just be sure and fix the table widths the same.

    See it in action at jsFiddle.

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

Sidebar

Related Questions

I have a table which looks like this: <table id='t'> <thead> .... </thead> <tbody
I have this table : <table> <thead> <tr> <th>Quantity</th> <th>&nbsp;</th> <th>Price</th> <th>Sum</th> </tr></thead> <tbody>
I want to have a table that the user can expand/contract the contents (but
I have a table with a code like this: <table cellpadding=6 rules=groups frame=no> <thead>
I have a table that looks like this: <table> <thead> <!-- random table headings
I have a table which has a thead section and a tbody section. I'm
I have a table, that looks like this: <table class=sortabletable> <thead> <tr> <th style=width:
I have a table: <table class=products> <thead>...</thead> <tfoot>...</tfoot> <tbody id=the-list> <tr id=order-0> <th scope=row
I have a table that looks something like this. <table> <thead> <tr> <th>Foo</th> <th>Bar</th>
I have a table like this: <table> <thead> <tr> <th colspan=1>a</th> <th colspan=3>b</th> </tr>

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.