On Jun 27, 2007, at 11:29 AM, Corey Frang wrote:

Not really, that selector finds ALL "tr" then any "tr" after each of those.

Assuming your calling it from something like this:

$(".showNextRow).click(function() {
  $(this).parents("tr").next("tr.hidden").show();
  return false;
});

also assuming that the t1 table isn't inside another table with a tr.hidden. That would get funny :)

In that case, changing the second line to this would do the trick:
          $(this).parents("tr:first").next("tr.hidden").show();

One thing you might want to consider is changing the class name from "hidden" to something less presentational. Question: When is a tr.hidden not hidden? Answer: When you've applied .show() to it! ;-) Another possibility would be to remove the "hidden" class instead of using .show(), like so:
          $(this).parents("tr:first").next().removeClass('hidden');

(No need here for "tr.hidden" in the .next() here because the next sibling of a <tr> has to be another <tr>, and if it doesn't have class="hidden" no harm done.)

Hope that helps,

Karl



Glen Lipka wrote:
$("tr").next("tr").show();

Would this do it?

Glen

On 6/27/07, Massimiliano Marini < [EMAIL PROTECTED]> wrote:

Hi all,

I've this table :

<table id="t1">
  <tr class="visible">
   <td><a href="#" class="showNextRow">View Next Row</td>
   <td>Cell with content</td>
  </tr>
  <tr class="hidden">
    <td colspan="2">Hello to the jQuery community</td>
  </tr>
  ...
  ...
  ...
</table>

I'm using this code to diplay the tr with hidden class :
$('a').filter('.visible').click(function(){
  $('.hidden').toggle();
}

what I want to do, is to toggle or show only the "tr"(only one only
the next) that is under the "tr" where is the link that I've clicked.

I think the example and the code may help more than my description of
the problem :)

--
Massimiliano Marini - http://www.linuxtime.it/massimilianomarini/
"It's easier to invent the future than to predict it."  -- Alan Kay



Reply via email to