=== jQuery code === $(function(){ $("a.toggle") .click(function(){ if ( $(this).parent("fieldset").hasClass("collapsed") ) { $(this).parent("fieldset").removeClass("collapsed"); } else { $(this).parent("fieldset").addClass("collapsed"); } }); });
=== HTML === <fieldset class="collapsible collapsed group_5"> <legend> <a class="toggle" href="javascript:void(0)">Board Meeting Minutes and Resolutions</a> </legend> <div class="container oddRow"> <div class="doc-date">02/13/2007</div> <div class="doc-title">Letter of Resignation - Vice President of Human Resources eff. 02/28/07</div> </div> </fieldset> === Notes === Doesn't error, but it sure doesn't do anything either. Tried alerting some attributes like class or the typeof $(this).parent("fieldset") but kept coming up with undefined. There isn't any other fieldset above that one. I used to have the code -- if ($ (this.parentNode.parentNode).hasClass("collapsed') -- and it worked. Can't determine what .parent() is doing for me here, besides frustrating. Appreciate any help or advice