var addCommentLink = $('div.primary-column div.comments-head a.leave-comment'); var expandCommentsLink = $('div.primary-column div.comments-head a.expand-comments'); expandCommentsLink.click(function() { $('dl.comments').toggle('fast').next().toggle('fast'); if($(this).hasClass('active')) { $(this).removeClass('active'); /* We've closed everything, so remove the active class from the add a comment link */ if(addCommentLink.hasClass('active')) {addCommentLink.text('Add your own').removeClass('active')}; } else { $(this).addClass('active'); } return false; }); $('div.primary-column #feedback_form.comments').show('fast');