JSFiddle - React, Tailwind, and code Playground

by gion_13

HTML

<div class="container" id="container1"></div>
<div class="container" id="container2"></div>

CSS

.container{
    width : 48%;
    float : left;
    overflow : auto;
    border : 1px solid #ccc;
    min-height : 200px;
}
.container div{
    float : left;
    width : 20px;
    height : 20px;
    margin : 2px;
}
#container1 div{
    background-color : red;
}

#container2 div{
    background-color : blue;
}

JavaScript

(function($) {
    var originalAppendTo = $.fn.appendTo;
    $.fn.appendTo = function(f) {
        el = typeof f === 'function' ? f.call(this) : f;
        return originalAppendTo.call(this, el);
    }
})(jQuery);

var $el1 = $('#container1'),
    $el2 = $('#container2'),
    F = function() {
        return Math.random() < 0.5 ? $el1 : $el2;
    };
for (var i = 0; i < 20; i++)
$('<div />').appendTo(F);