JSFiddle - React, Tailwind, and code Playground
HTML
<div id="start">
<div class="element">one</div>
<div class="element">two</div>
<div class="element">three</div>
</div>
<div id="target"></div>
CSS
#start,
#target
{
width: 200px;
height: 200px;
border: 1px solid #ccc;
margin: 0 20px;
float: left;
}
.element {
height: 30px;
background: #f1f1f1;
margin: 10px;
float: left;
}
JavaScript
$('.element').click(function() {
var cont = $(this).parent().attr('id');
if (cont == 'start') {
var place = '#target';
} else {
var place = '#start';
}
$(place).append($(this));
});