JSFiddle - React, Tailwind, and code Playground

HTML

<span class="sp">CLICK</span><br />

<div class="z"></div>
<div class="x">123</div>

CSS

.z { background: yellow; }
.x { background: green; }

JavaScript

$('.sp').click(function() {
	var code = $('.x')[0].outerHTML.replace(/</g, '&lt;').replace(/>/g, '&gt;');
	$('.z').text(code);
});