Possible Duplicate:
Is there a native jQuery function to switch elements?
I have list of items in my HTML, I want to change places of first and last element, but how can I do that with jQuery? I can get first and last elements, but how can I change their places (order) in list?
Example HTML:
<ul>
<li id="item-1">1</li>
<li id="item-2">2</li>
<li id="item-3">3</li>
</ul>
jQuery:
var first = $("ul li:first");
var last = $("ul li:last");