Is there a native jQuery function to switch elements?
Here's an interesting way to solve this using only jQuery (if the 2 elements are next to each other):
$("#element1").before($("#element2"));
or
$("#element1").after($("#element2"));
Paulo's right, but I'm not sure why he's cloning the elements concerned. This isn't really necessary and will lose any references or event listeners associated with the elements and their descendants.
Here's a non-cloning version using plain DOM methods (since jQuery doesn't really have any special functions to make this particular operation easier):
function swapNodes(a, b) {
var aparent = a.parentNode;
var asibling = a.nextSibling === b ? a : a.nextSibling;
b.parentNode.insertBefore(a, b);
aparent.insertBefore(b, asibling);
}