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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:02:35+00:00 2026-06-10T23:02:35+00:00

Ok, so say I have got a table that looks like this: <table class=first-table

  • 0

Ok, so say I have got a table that looks like this:

<table class="first-table" border="1" width="400px">
   <tr>
       <td><?php echo $row_cond['title']; ?></td>
       <td><a class="more" href="#" onClick="slideup()">Display More</a></td>
   </tr>
   <tr class="full_result">
       <td colspan="2"><?php echo $row_cond['description']; ?></td>
   </tr>
</table>

You can see I have got a link that when clicked will call the slideUp() function to show or hide the tr with the “full_result” class:

var command = false;
function slideup() { //New function SlidUp
    if (command == false){
         $('.full_result').fadeIn();
         $('.more').text('Display More');
         command = true;
    }else{
         $('.full_result').hide();
         $('.more').text('Display Less');
         command = false;
    }
}

So the trick is, this is in a while loop and is repeated many times. So how do I make it so that when I click on the link, only the class “full_result” is shown in the table where I clicked the link.

At the moment when I click the button in any table, all the classes show and hide at the same time.

My Solution

$('.full_result').hide();
$(".more").on("click",function(){
    $('.more').html('Display More');
    $('.full_result').hide();
    $(this).parents("tr").next().next().fadeIn();
    $(this).html('');
    return false; //This stops the page jumping to the top of the page when I click the link
});
  • 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-10T23:02:37+00:00Added an answer on June 10, 2026 at 11:02 pm

    Try to change your JS code this way and remove “onClick” attribute from “.more” links:

    var command = false;
    $(".more").on("click",function(){
        if (command == false){
             $(this).parents("tr").next().fadeIn();
             $(this).html('Display Less');
             command = true;
        }else{
              $(this).parents("tr").next().hide();
             $(this).html('Display More');
             command = false;
        }
    });
    

    See jsfiddle

    EDIT

    If you have more than one row below row “.more” you can use .nextAll() to show/hide all next rows. And just use .slideToggle() to avoid using “var command“. This code:

    $(".more").on("click",function(){    
             $(this).parents("tr").nextAll().fadeToggle();
             if($(this).html()=="Display More") $(this).html('Display Less');            
             else $(this).html('Display More');
    });
    

    See new 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 that looks something like this: <table> <tr id=1> <td>bla</td> </tr>
I've got a query that presently looks something like this (I'll simplify it to
I have a schema that looks like this: +----------+ | tour | +----------+ |
This question about Timers for windows services got me thinking: Say I have (and
Lets say have this immutable record type: public class Record { public Record(int x,
Let's say I've got a table that I'm trying to convert. Its got column
It seems this problem is quite popular on programming. I have a table that
Say I have a Student table, it's got an int ID. I have a
First off, i'd like to say that my programming knowledge is very basic and
I've got some financial data to store and manipulate. Let's say I have 2

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.