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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:47:41+00:00 2026-06-09T06:47:41+00:00

I have the following code that is working (clicking on the link will show

  • 0

I have the following code that is working (clicking on the link will show the next hidden table row):

HTML:

<table>

<a href="#" class="showrows">Add row</a>

<tr class="cache">
<td><input type="text"  size="15"></td>
<td><input type="text"  size="15"></td>
</tr>

<tr class="cache">
<td><input type="text"  size="15"></td>
<td><input type="text"  size="15"></td>
</tr>


</table>

and my JS:

$(document).ready(function() {

$('tr.cache').css("display","none");

$('.showrows').live('click',function(e){
   e.preventDefault();
   $('tr:hidden:first').show("fast");   
});

});

But now I need to have several tables like the current one (see above) on the same page, each one with its own “showrows” functionality. Actually I need my JQuery code to find to which table the link belongs to, then find the first hidden row of this table, and show it…

I have tried all the following solutions, one by one:

$(this).closest('tr.cache').show("fast");
$(this).closest('tr:hidden:first').show("fast");
$(this).closest('table').find('tr:hidden:first').show("fast");
$(this).closest('tr').show("fast");
$(this).parents('table').next('tr:hidden:first').show("fast");

and none is working! What’s the issue according to you? Thanks for your 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-06-09T06:47:43+00:00Added an answer on June 9, 2026 at 6:47 am

    add a table row and a table cell around your link, you have an invalid HTML markup

    what the browser(most) browsers do they will give you this markup:

    <a class="showrows" href="#">Add row</a>
    <table>
        <tbody>
            <tr class="cache">
                <td><input type="text" size="15"></td>
                <td><input type="text" size="15"></td>
            </tr>
            <tr class="cache">
                <td><input type="text" size="15"></td>
                <td><input type="text" size="15"></td>
            </tr>
        </tbody>
    </table>
    

    so you need to change your markup a bit:

    <table>
      <tr>
        <td colspan="2">
          <a href="#" class="showrows">Add row</a>
        </td>
      </tr>
      <tr class="cache">
        <td><input type="text"  size="15"></td>
        <td><input type="text"  size="15"></td>
      </tr>
    
      <tr class="cache">
        <td><input type="text"  size="15"></td>
        <td><input type="text"  size="15"></td>
      </tr>
    
    </table>
    

    and use the jQuery code:
    $(document).ready(function() {

      $('tr.cache').css("display","none");
    
      $('.showrows').live('click',function(e){
        e.preventDefault();
        var table = $(this).closest("table");
        $('tr:hidden:first', table).show("fast");   
      });
    

    });

    demo:

    http://jsbin.com/owefew/1/edit

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

Sidebar

Related Questions

I have the following code that is working fine in jsfiddle - http://jsfiddle.net/darkajax/FHZBy/ I've
I have the following code that has @item.ID from razor: <a href=# id=deleteitem(@item.ID)>Delete</a> When
I have the following code that returns a .CSV file when a link is
I have the following code that I am working on for my college assignment.
I have the following code that isn't working in IE, any thoughts? <script type=text/javascript
I have the following code that is working on my local machine (Win 7,
I have the following code for consuming a service that is not working for
I have the following code that is working but when I hit the hardware
I have the following code that is applied to a forward and next button.
I have following code that I am compiling in a .NET 4.0 project namespace

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.