JSFiddle - React, Tailwind, and code Playground

HTML

<html>
    <head>
        <link rel=stylesheet type=text/css href="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/themes/start/jquery-ui.css">
        <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/jquery-ui.min.js"></script>
    </head>            
    <body>
        <div id=b1><button>b1</button></div>
        <div id=b2><button>b2</button></div>
    </body>
</html>

JavaScript

$(function(){ // when dom ready
    var b1first=true;
    $("button").button().click(function(e){
        if (b1first){
            $("#b1").detach().appendTo("body");
            b1first=false;
        }else{
            $("#b2").detach().appendTo("body");
            b1first=true;
        }
    }); 
});