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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:54:08+00:00 2026-05-26T03:54:08+00:00

I’m not sure why this isn’t working… HTML <table> <tr> <th>Name</th> <th>Options</th> </tr> <?php

  • 0

I’m not sure why this isn’t working…

HTML

<table>
<tr>
  <th>Name</th>
  <th>Options</th>
</tr>
<?php // loop over items
while ($row = mysql_fetch_assoc($qry)){ ?>
  <tr>
    <td><?=$row['name'];?></td>
    <td<a href="#" class="trigger">Detail</a></td>
  </tr>
  <tr>
    <td colspan="100%" class="details">
    stuff
    </td>
  </tr>
  <?php
} ?>
</table>

Then the jQuery I’m using is…

$(document).ready(function () {  
  $('.trigger').click(function() {
    $(this).parents("table").siblings(".details").slideToggle();
    // also tried this...
    // $(this).parents("table").nextAll(".details").slideToggle();
    return false;
  });
});  

I’ve tried moving the details class to the TR. What I’d like is when someone clicks the “Detail” link the following TR should toggle. I’ve put an ID on the top table and alerted attr(‘id’) of parent and that works. Changing “.siblings” to “.find” toggles them all.

Thanks for any help.

  • 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-26T03:54:09+00:00Added an answer on May 26, 2026 at 3:54 am

    your html is malformed
    and your jquery is not doing selecting the right item… you go up to the table element, and then try a sibbling but that results in nothing.

    try this html:

    <table>
    <tr>
      <th>Name</th>
      <th>Options</th>
    </tr>
    <?php // loop over items
    while ($row = mysql_fetch_assoc($qry)){ ?>
      <tr>
        <td><?=$row['name'];?></td>
        <td><a href="#" class="trigger">Detail</a></td>
      </tr>
      <tr class="details">
        <td colspan="2">
        stuff
        </td>
      </tr>
      <?php
    } ?>
    </table>
    

    and this jquery:

    $(function(){
      $('.trigger').click(function() {
        $(this).parents("tr").next().slideToggle();
        return false;
      });
    });
    

    working example:
    http://jsfiddle.net/saelfaer/Z6MzS/

    edit
    just to mention what i changed

    you had a <td> open tag which was missing its >, also, i moved the class="details" to the <tr> element that is to be shown / hidden.

    in the jquery i changed your selector going up to the table, into going up to the table row and selected the .next() table row (which is actually the one that needs to be shown or hidden. then toggled that one.

    improvements you can make:
    hide the tr.details trough css at first

    tr.details {
      display: none;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on
For some reason, after submitting a string like this Jack’s Spindle from a text
I want to count how many characters a certain string has in PHP, but
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I need a function that will clean a strings' special characters. I do NOT

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.