JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
<button>добавить квадрат</button>
<div id="handler">
<div class="square"></div>
</div>
CSS
div.square { width: 150px; height: 150px; background: #eee; }
JavaScript
$(function() {
$(".square").draggable();
$("button").click(function(e){
e.preventDefault();
var square = $('<div class="square"></div>').css('background', 'rgb('
+ (Math.floor(Math.random() * 256)) + ','
+ (Math.floor(Math.random() * 256)) + ','
+ (Math.floor(Math.random() * 256)) + ')');
square.draggable({axis:'y');
$('#handler').append(square);
})
});