How to select appended element in UL list
<p>I want to add an LI to my UL list below above the .last-child:</p>

<pre><code>&lt;ul id="list"&gt;
    &lt;li&gt;item 1&lt;li&gt;
    &lt;li&gt;item 2&lt;li&gt;
    &lt;li&gt;item 3&lt;li&gt;
    &lt;li class="last-child"&gt;&lt;li&gt;
&lt;/ul&gt;
</code></pre>

<p>I am using the following JQuery code to do so:</p>

<pre><code>var result = '&lt;li&gt;item 4&lt;/li&gt;';
$("#list li.last-child").before(result);
</code></pre>

<p>That all works fine. However, I want to select the newly added row... Normally I guess I could use the following code to select the last LI:</p>

<pre><code>var $newrow = $('#list').find('li:last');
</code></pre>

<p>But in this case I want to select the second last LI... How do I select the second last LI which is the one I just inserted?</p>

<p>Am I making sense?</p>

<p>Thanks in advance!</p>
