Here are some examples of what you could do:
Var list = $('#mylist'), items = list.find('li');
items.filter(':eq(3)').insertBefore(items.filter(':eq(2)')); // swap the 2nd and 3rd elements
items.filter(':first').insertAfter(items.filter(':last')); // move first item to the end
items.filter(':gt(3)').prependTo(list); // move all items with index greater than 3 to the top of the list
There are endless ways to manipulate the DOM elements. Check out the jQuery API available at the URL below to see all the methods available to do insertions.
api.jquery.com
Var list = $('#mylist'), items = list.find('li');
items.filter(':eq(3)').insertBefore(items.filter(':eq(2)')); // swap the 2nd and 3rd elements
items.filter(':first').insertAfter(items.filter(':last')); // move first item to the end
items.filter(':gt(3)').prependTo(list); // move all items with index greater than 3 to the top of the list
There are endless ways to manipulate the DOM elements. Check out the jQuery API available at the URL below to see all the methods available to do insertions.
api.jquery.com