JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<button>Add Thing</button>
<div class="canvas"></div>
CSS
.thing {
width: 50px;
height: 50px;
background: red;
}
.close {
background: blue;
color: white;
}
.canvas {
border: 1px solid black;
width: 500px;
height: 500px;
}
JavaScript
$(document).ready(function(){
$('body').on('click', 'button', function(){
var thing = '<div class="thing"></div>';
var close = '<a href="#" class="close">close</a>';
$(thing).append(close);
$('.canvas').append(thing);
return false;
});
});