title: jQuery onclick delete table row
body: <p>How to delete table row on click?</p>
  
  <p>Here is a <a href="http://jsfiddle.net/lolipop/DjhuY/1/" rel="nofollow">jsfiddle</a>.</p>
  
  <p>I want to delete only row on which del link is nested, not the last row how script is doing now.</p>
  
  <p>Onclick calling <strong><code>delTableRow()</code></strong> function and that function need to be changed to delete nested del link row.</p>
  
  <pre><code>&lt;script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
  function addTableRow(jQtable){
      jQtable.each(function(){
          var tds = '&lt;tr&gt;';
          jQuery.each($('tr:last td', this), function() {tds += '&lt;td&gt;'+$(this).html()+'&lt;/td&gt;';});
          tds += '&lt;/tr&gt;';
          if($('tbody', this).length &gt; 0){$('tbody', this).append(tds);
          }else {$(this).append(tds);}
      });
  }
  function delTableRow(jQtable){
      jQtable.each(function(){
          $('tr:last', this).remove();
      });
  }
  &lt;/script&gt;
  &lt;table width="100%" border="1" cellspacing="0" cellpadding="0" id="mans"&gt;
    &lt;tr&gt;
      &lt;td&gt;11&lt;/td&gt;
      &lt;td&gt;12&lt;/td&gt;
      &lt;td&gt;13&lt;/td&gt;
      &lt;td&gt;&lt;a onclick="delTableRow($('#mans'));" href="#"&gt;del&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;21&lt;/td&gt;
      &lt;td&gt;22&lt;/td&gt;
      &lt;td&gt;23&lt;/td&gt;
      &lt;td&gt;&lt;a onclick="delTableRow($('#mans'));" href="#"&gt;del&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;31&lt;/td&gt;
      &lt;td&gt;32&lt;/td&gt;
      &lt;td&gt;33&lt;/td&gt;
      &lt;td&gt;&lt;a onclick="delTableRow($('#mans'));" href="#"&gt;del&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>