Toggle table row siblings
<p>I have a table structured like this:</p>

<pre><code>&lt;table&gt;
&lt;tr id="id1" class="parent"&gt;&lt;/tr&gt;
&lt;tr class="id1"&gt;&lt;/tr&gt;
&lt;tr class="id1"&gt;&lt;/tr&gt;
&lt;tr class="id1"&gt;&lt;/tr&gt;
&lt;tr class="id1"&gt;&lt;/tr&gt;

&lt;tr id="id2" class="parent"&gt;&lt;/tr&gt;
&lt;tr class="id2"&gt;&lt;/tr&gt;
&lt;tr class="id2"&gt;&lt;/tr&gt;
&lt;tr class="id2"&gt;&lt;/tr&gt;
&lt;tr class="id2"&gt;&lt;/tr&gt;

.....etc
&lt;/table&gt;
</code></pre>

<p>As you can see child classes are coresponding to their parent id. Now I want to toggle all the rows which have class names equal to their parent row id whenever parent row is clicked.</p>

<p>I have tried this, perhaps stupid try:) and can't seem to get this working:</p>

<pre><code>  $('tr.parent').click(function() {
    //alert('yay');
    var tog = $(this).attr('id');
    $(this).siblings().hasClass(tog).slideToggle();
    return false;
  });
</code></pre>

<p>Thanks.</p>
