Inserting one element inside another in jQuery
<p><strong>EDIT:</strong> Apologies, this was caused by an unrelated error!</p>

<p><hr /></p>

<p>Hi,</p>

<p>I'm trying to figure out how to add one element inside another using jQuery.</p>

<p>For example, if I have a list:</p>

<pre><code>&lt;ul class="someList"&gt;
    &lt;li&gt;One&lt;/li&gt;
    &lt;li&gt;Two&lt;/li&gt;
&lt;/ul&gt;
</code></pre>

<p>...and I run <code>$("ul.someList").prepend("&lt;li&gt;Zero&lt;/li&gt;");</code> then I will end up with this:</p>

<pre><code>&lt;ul class="someList"&gt;
    &lt;li&gt;Zero&lt;/li&gt;
    &lt;li&gt;One&lt;/li&gt;
    &lt;li&gt;Two&lt;/li&gt;
&lt;/ul&gt;
</code></pre>

<p>That's great. However, if the list is empty...</p>

<pre><code>&lt;ul class="someList"&gt;

&lt;/ul&gt;
</code></pre>

<p>...then <code>$("ul.someList").prepend("&lt;li&gt;Zero&lt;/li&gt;");</code> simply does not work. Is there a method of prepending the list item when there are no existing list items as well as if there are some already?</p>

<p>Thanks in advance.</p>
