Dynamic change of class of <TR> with Jquery -


this first post, , first please forgive me poor english.

i have problem can't fix:

i have <table> of questions,

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

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

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

the first question done (class:done) , 2nd question should 1 react click(), , on... doesn't work: other <tr> appear when click on 1st <tr>.

can give me hand on problem ? thank you.

since adding classes dynamically , click event handler class selector based have use .live() event.

$('.visible:not(.done)').live("click", function(){      $(this).addclass('done');      $('.hidden:first').toggle(500).removeclass('hidden').addclass('visible'); }); 

working demo


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -