jQuery remove last-child of a class
<p>I am working on a dynamic form, the rows are having parent dropdowns, and when we select a parent it adds new ROWs for number of childs, I have given classes to each child rows. There is option of dynamically adding a parent row, and so on.</p>

<p>So far adding and deleting the parent rows are working fine. I am having trouble removing the last child row</p>

<p>below is a rough idea of how the rows are created, the </p>

<pre><code>  Row 1: &lt;parent&gt; select
  Row 2: -&lt;child&gt; select
  Row 3: -&lt;child&gt; select
  Row 4: - Child Add row / Remove row
  Row 5: &lt;parent&gt; select
  Row 6: -&lt;child&gt; select
  Row 7: - Child Add row / Remove row
  Row 8: Parent Add row / remove row
</code></pre>

<p>for better idea here is the screenshot</p>

<p><img src="http://i.stack.imgur.com/nmdjy.jpg" alt="enter image description here">  </p>

<p>This table is simple, no nested tables, only 6 columns and 12 rows, the indenting is done via css  </p>

<p>Now if I use <code>$('tr.partnumber_2_sub');</code> in console of firebug, i can see result like</p>

<pre><code>Object[tr.partnumber_2_sub, tr.partnumber_2_sub, tr.partnumber_2_sub]
</code></pre>

<p>but when i use <code>$('tr.partnumber_2_sub:last-child');</code> it output empty object. I want to remove the last child and my guess was to <code>$('tr.partnumber_2_sub:last-child').remove();</code> but it is not working.</p>

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

<p>Thanks for the answers for the last row, but i realized that my child add row / del row are also having same class on tr. Now i have to remove 2nd last element </p>

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

<p>Okay, i have added extra class on tr of child row, and didnt added it add / del of child so now I can use them separately. changed back the title and accepted the answer.</p>

<p>Than you all</p>
