remove table row using jquery
<p>Hello friends following is my code</p>

<p><strong>SCRIPT</strong></p>

<pre><code>$(document).ready(function(){
$('#click').click(function(){
    $('#table').append('&lt;tr&gt;&lt;td&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;');
})
$('#remove').click(function(){
    $('#table').remove('&lt;tr&gt;&lt;td&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;');
})
})
</code></pre>

<p><strong>HTML</strong></p>

<pre><code>    &lt;table width="100%" border="1" cellspacing="0" cellpadding="0" id="table"&gt;
      &lt;tr&gt;
        &lt;td&gt;&amp;nbsp;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&amp;nbsp;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/table&gt;
&lt;div id="click"&gt;click&lt;/div&gt;
&lt;div id="remove"&gt;remove&lt;/div&gt;
</code></pre>

<p>when I add row it works great but I dont know how to delete the last row of the table you can also check the online <a href="http://jsfiddle.net/2mZnR/" rel="nofollow">demo</a></p>

<p>Please Help </p>

<p>Thanks in advance :)</p>

<p><strong>EDIT</strong></p>

<p>Thank to all friends for their precious help i have one more question sorry for asking more ...</p>

<p>I want when user also click on any row it will delete itself i have tried out but there is a problem if you click on the row its delete itself but when you add row by click in #click. then row not deleting itself by clicking on it </p>

<p>here my code </p>

<p><strong>SCRIPT</strong></p>

<pre><code>$(document).ready(function(){
$('#click').click(function(){
    $('#table').append('&lt;tr&gt;&lt;td&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;');
})
$('#remove').click(function(){
    $('#table tr:last').remove();
})
$('#table tr').click(function(){

$(this).remove();

});
})
</code></pre>
