JSFiddle - React, Tailwind, and code Playground

by jomanlk

HTML

<div>This DIV is on top</div>
<div>This DIV is on bottom</div>

<button id='swap'>Swap</button>

CSS

div {
    margin: 20px;
    padding: 20px;
    height: 40px;
    background: #00aa00;
}

JavaScript

$('#swap').click(function(){
    $('div:first').insertAfter('div:eq(1)');
});