Dynamic change of class of <TR> with Jquery

Posted by Coronier on Stack Overflow See other posts from Stack Overflow or by Coronier
Published on 2010-04-29T10:00:39Z Indexed on 2010/04/29 10:07 UTC
Read the original article Hit count: 175

Filed under:

Hi all,

This is my first post, and first please forgive me for my poor english.

I have a problem I really can't fix:

I have a <table> of questions,

  1. the first question is visible (class:visible), the others are hidden (class:hidden)

            $(document).ready(function(){
            $('.hidden').hide();
    
  2. When people click on the first question, I want the second question to appear (and the first question to turn to grey, using a 'done' class).

$('.visible:not(.done)').click(function(){ 
                $(this).addClass('done'); 
                $('.hidden:first').toggle(500).removeClass('hidden').addClass('visible');
            })

The first question is now done (class:done) and the 2nd question should be the only one to react to a click(), and so on... But it doesn't work: the other <tr> appear only when I click on the 1st <tr>.

Can someone give me a hand on this problem ? Thank you.

© Stack Overflow or respective owner

Related posts about jQuery