Posted By

conspirator on 02/06/09


Tagged

toggle DOM jquery dd traversing dt


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

umang_nine
vali29


Simple Toggle


 / Published in: jQuery
 

  1. $("dl dd").hide();
  2. $(".text_link").click(function(){
  3. var target = $(this).parent().next();
  4. var junk = $(this).parent().next().next();
  5.  
  6. if ( $(target).is(':hidden') ) {
  7. $(junk).slideUp();
  8. $(target).slideDown();
  9. } else {
  10. $(target).slideUp();
  11. }
  12. });
  13. $(".html_link").click(function(){
  14. var junk = $(this).parent().next();
  15. var target = $(this).parent().next().next();
  16.  
  17. if ( $(target).is(':hidden') ) {
  18. $(junk).slideUp();
  19. $(target).slideDown();
  20. } else {
  21. $(target).slideUp();
  22. }
  23. });

Report this snippet  

You need to login to post a comment.