jQuery Parent Sibling selector

Viewed 51742

I have a HTML document like below:

<td>
  <div class="commentLink">
    <a href="javascript:ShowBox()">Show</a>
  </div>
  <div class="hiddenBox">
    <!-- Hidden content  -->
  </div>
</td>

The div element with class="hiddenBox" is hidden by default. On clicking the "Show" link, I want to show the hidden div. I tried this but it doesn't work:

function ShowBox() {
  $(function(){
    $(this).parent().siblings(".hiddenBox").show();
  });
}

The class hiddenBox occurs multiple times in my document, but I want only the sibling to show.

3 Answers
Related