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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T18:38:12+00:00 2026-06-04T18:38:12+00:00

How can I toggle two rows that are in the same table independently. Currently

  • 0

How can I toggle two rows that are in the same table independently. Currently I have two main rows and each main row contains some other rows when I click on any row both the main rows get toggled how can I toggle them independently ?

My HTMl and javascript is as

<table id="sort">
    <tr class="nodrag nodrop">
       <td colspan=3><strong><a style="cursor:pointer;" class="toggle">Group 1</a></strong></td>
       <td style="text-align: right;"><a class="button3" href="#" ><span> Edit </span></a> <a class="button3" href="#" ><span> Delete </span></a></td>
   </tr>
        <tr id="1" class="tr_group" style='display:none;'>
            <td style="width:10px;" class="dragHandle">&nbsp;</td>
            <td><a href=# style="margin-left: 20px;">Umair Iqbal</a></td>
            <td><span style="font-size: 12px; color: #999; line-height: 100%;">A Student at TUM</span></td>
            <td style="text-align: right;"><a class="button3" href="#" ><span> Edit </span></a> <a class="button3" href="#" ><span> Delete </span></a></td>
        </tr>
        <tr id="2" class="tr_group" style='display:none;'>
            <td style="width:10px;" class="dragHandle">&nbsp;</td>
            <td><a href=# style="margin-left: 20px;">Faryal Khan</a></td>
            <td><span style="font-size: 12px; color: #999; line-height: 100%;">A Doctor at KMC</span></td>
            <td style="text-align: right;"><a class="button3" href="#" ><span> Edit </span></a> <a class="button3" href="#" ><span> Delete </span></a></td>
        </tr> 

  <tr class="nodrag nodrop">
     <td colspan=3><strong><a style="cursor:pointer;" class="toggle">Group 2</a></strong></td>
     <td style="text-align: right;"><a class="button3" href="#" ><span> Edit </span></a> <a class="button3" href="#" ><span> Delete </span></a></td>
  </tr>
        <tr id="1" class="tr_group" style='display:none;'>
            <td style="width:10px;" class="dragHandle">&nbsp;</td>
            <td><a href=# style="margin-left: 20px;">Umair Iqbal</a></td>
            <td><span style="font-size: 12px; color: #999; line-height: 100%;">A Student at TUM</span></td>
            <td style="text-align: right;"><a class="button3" href="#" ><span> Edit </span></a> <a class="button3" href="#" ><span> Delete </span></a></td>
        </tr>
        <tr id="2" class="tr_group" style='display:none;'>
            <td style="width:10px;" class="dragHandle">&nbsp;</td>
            <td><a href=# style="margin-left: 20px;">Faryal Khan</a></td>
            <td><span style="font-size: 12px; color: #999; line-height: 100%;">A Doctor at KMC</span></td>
            <td style="text-align: right;"><a class="button3" href="#" ><span> Edit </span></a> <a class="button3" href="#" ><span> Delete </span></a></td>
        </tr> 
</table>

And the jQuery is

<script>
$(".toggle").click(function () {
$(".tr_group").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-06-04T18:38:13+00:00Added an answer on June 4, 2026 at 6:38 pm

    Select the next group of tr elements based on the clicked element.

    $(".toggle").click(function(){
        $(this).closest('tr').nextUntil(":not(.tr_group)").slideToggle('slow');
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table of data that contains about 260 rows. Each of these
The javascript code I now have can toggle a single row of data. Whether
I currently have two input fields which toggle the value value to either true
So I wanted to create a toggle-button for a table, where I can make
I have a menu with submenus that can be toggled (hide/show type deal). Is
I'm trying to build some HTML with Knockout that Jquery UI can turn into
(Jquery) I have two divs that I'm toggling back and forth (show and hide)
I have a main window which hosts two views (user controls). One is UserControl1
I have a UIView that will need to display two UITableViews, but they are
I am having a problem toggling some content that was clicked.The two items are

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.