Column rowspan using jquery
<p>I have a table with a double click event on every each of the rows. When I double click on any row, it will display another row called ".matching". Besides that, I also want to create a column rowspan if a hidden ".matching" row is displayed. Below shows my php part:</p>

<pre><code>&lt;table&gt;
&lt;tr ondblclick="rowdoubleclick(this);"&gt;
  &lt;td&gt;...&lt;/td&gt;
  &lt;td&gt;...&lt;/td&gt;
  &lt;td class="lastcolumn"&gt;Rowspan is here&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class="matching" style="display:hidden;"&gt;
  &lt;td colspan="2"&gt;Hidden row shows here&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
</code></pre>

<p>And this is my jquery:</p>

<pre><code>function rowdoubleclick(e) {
  var tablerow = $(e).closest('tr');
  var rowammend = $('.lastcolumn'); 
  var matching = $(e).closest('tr').next('tr.matching'); 

  if(matching.is(":hidden")) { 
      tablerow.attr('rowspan','2').css({'border-bottom':'transparent'}); 
      matching.slideToggle("fast");
      rowammend.attr('rowspan','2');
  }
  else {
      tablerow.css({'border-bottom':'1px solid #939393'}); 
      matching.hide();
      rowammend.attr('rowspan','1');
  }
}
</code></pre>

<p>The problem with this code, when i double click on any row, it creates the rowspan on another row. Or in another word, it create all rowspan to all of the rows in the table.
How to add particular column rowspan to that particular double click row event?</p>