JSFiddle - React, Tailwind, and code Playground

HTML

<span class="sp">CLICK</span><br /><br />
<span class="sp2">CLICK2</span><br /><br />
<textarea type="text" cols="60" rows="10"/></textarea>

JavaScript

$('.sp').click(function() {
$('textarea').html('<div class="z"></div>');
});
$('.sp2').click(function() {
$('textarea .z').append('<div class="x"></div>');
});