I have a list of comments with a reply option. When the reply button is clicked a form should appear below the comment.
HTML:
<div id="" class="comment">
<div class="comment-message">Message
<div class="information">
<a id="" class="comment-reply" href="/comments/reply/"> Reply </a>
</div>
</div>
</div>
<div class="test">Test</div>
CSS:
.test{display:none;}
jQuery:
$('.comment-reply').live("click", function(e) {
e.preventDefault();
$this = $(this);
$this.closest('.test').toggle();
});
I have tried using the following:
$this.closest('.test').toggle();
Any help on this would be much appreciated , Thank you.
If your html structure is same then you can try below,
In case if there are some elements between the
Replysection and thetestthen use.nextAll