How to rearrange elements using jQuery ?
Orginal Code :
1 2
1
2
You can use .insertBefore():
$("#paragraph3").insertBefore("#paragraph2");
Slightly more elaborate example (clicking on a paragraph moves it up):
$("p").click(function() { $(this).insertBefore($(this).prev()); });
You can test both examples here.