EDIT: Apologies, this was caused by an unrelated error!
Hi,
I'm trying to figure out how to add one element inside another using jQuery.
For example, if I have a list:
<ul class="someList">
<li>One</li>
<li>Two</li>
</ul>
...and I run $("ul.someList").prepend("<li>Zero</li>");
then I will end up with this:
<ul class="someList">
<li>Zero</li>
<li>One</li>
<li>Two</li>
</ul>
That's great. However, if the list is empty...
<ul class="someList">
</ul>
...then $("ul.someList").prepend("<li>Zero</li>");
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?
Thanks in advance.