Possible Duplicate:
jQuery: how to add <li> in an existing <ul>?
I have a <UL>
which contains a list of <LI>
. What I am looking at is on an event to add a new <LI>
item as the first element on the <UL>
. Can you please advice on how I can acheive this using jquery.
Example:
<UL>
<LI>First Item</LI>
<LI>Second Item</LI>
<LI>Third Item</LI>
<LI>Fourth Item</LI>
</UL>
on click of a button, i will need to add a new LI element as the first element in the UL, which would look like the below
<UL>
<LI>New Item is here</LI>
<LI>First Item</LI>
<LI>Second Item</LI>
<LI>Third Item</LI>
<LI>Fourth Item</LI>
</UL>