JSFiddle - React, Tailwind, and code Playground
by h2ooooooo
HTML
<div class="test">hello 1</div>
<div class="test">hello 2</div>
<div class="test">hello 3</div>
JavaScript
$.fn.moveUp = function() {
$.each(this, function() {
$(this).after($(this).prev());
});
};
$.fn.moveDown = function() {
$.each(this, function() {
$(this).before($(this).next());
});
};
$("div:eq(2)").moveUp();
$("div:eq(0)").moveDown();